head 1.21; access; symbols PETIDOMO_4_0b6:1.21 PETIDOMO_4_0b5:1.21 PETIDOMO_4_0b4:1.21 PETIDOMO_4_0b3:1.21 BEFORETHL:1.20; locks; strict; comment @ * @; 1.21 date 2004.02.02.19.50.25; author thl; state Exp; branches; next 1.20; 1.20 date 2001.01.20.14.29.28; author simons; state Exp; branches; next 1.19; 1.19 date 2001.01.20.13.52.41; author rse; state Exp; branches; next 1.18; 1.18 date 2001.01.20.13.42.01; author simons; state Exp; branches; next 1.17; 1.17 date 2001.01.19.12.49.44; author simons; state Exp; branches; next 1.16; 1.16 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.15; 1.15 date 2001.01.16.11.33.36; author simons; state Exp; branches; next 1.14; 1.14 date 2001.01.16.10.49.08; author simons; state Exp; branches; next 1.13; 1.13 date 2001.01.15.18.48.49; author simons; state Exp; branches; next 1.12; 1.12 date 2001.01.15.17.06.48; author simons; state Exp; branches; next 1.11; 1.11 date 2001.01.15.16.58.58; author simons; state Exp; branches; next 1.10; 1.10 date 2001.01.15.16.55.45; author simons; state Exp; branches; next 1.9; 1.9 date 2001.01.15.16.35.06; author simons; state Exp; branches; next 1.8; 1.8 date 2001.01.15.16.29.11; author simons; state Exp; branches; next 1.7; 1.7 date 2001.01.11.14.17.53; author simons; state Exp; branches; next 1.6; 1.6 date 2001.01.11.14.11.33; author simons; state Exp; branches; next 1.5; 1.5 date 2001.01.08.20.36.19; author simons; state Exp; branches; next 1.4; 1.4 date 2001.01.08.15.55.07; author simons; state Exp; branches; next 1.3; 1.3 date 2001.01.06.14.12.21; author simons; state Exp; branches; next 1.2; 1.2 date 2000.12.16.13.11.54; author simons; state Exp; branches; next 1.1; 1.1 date 2000.12.13.15.54.29; author simons; state Exp; branches; next ; desc @@ 1.21 log @both peti and rse did overlapping work based on (untagged) 4.0b1; peti committed to the CVS first (no version created ever); this is an attempt to manually merge rse's acl pre/post changes in (claim themselfs to lead to 4.0b2 @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v $ $Revision: 1.20 $ Copyright (C) 2000 by CyberSolutions GmbH, Germany. This file is part of Petidomo. Petidomo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Petidomo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #ifndef __PETIDOMO_H__ #define __PETIDOMO_H__ 1 /********** Useful defines and declarations **********/ #ifndef __HAVE_DEFINED_BOOL__ # define __HAVE_DEFINED_BOOL__ 1 typedef int bool; #endif #ifndef DEBUG_DMALLOC # define xmalloc(size) malloc(size) # define xstrdup(string) strdup(string) #endif #undef FALSE #define FALSE 0 #undef TRUE #define TRUE 1 /********** Includes all modules need **********/ #include #include #include #include #ifdef DEBUG_DMALLOC # include #endif /********** main.c **********/ extern char g_is_approved; extern const char* who_am_i; extern char* masterconfig_path; /********** config.c **********/ struct PD_Config { char * fqdn; char * master_password; char * mta; char * mta_options; char * list_dir; char * ack_queue_dir; char * help_file; char * acl_file_pre; char * acl_file_post; char * index_file; }; enum list_type_t { LIST_OPEN, LIST_CLOSED, LIST_MODERATED, LIST_ACKED, LIST_ACKED_ONCE }; typedef enum { ACL_PRE, ACL_POST } acl_type_t; enum subscription_type_t { SUBSCRIPTION_PUBLIC, SUBSCRIPTION_ADMIN, SUBSCRIPTION_ACKED }; struct List_Config { unsigned int listtype; unsigned int subtype; int allowmembers; char * fqdn; char * admin_password; char * posting_password; char * postingfilter; char * archivepath; char * reply_to; char * intro_file; char * desc_file; char * sig_file; char * header_file; char * acl_file_pre; char * acl_file_post; char * list_dir; char * address_file; char * ack_file; }; int InitPetidomo(const char*); const struct PD_Config *getMasterConfig(void); const struct List_Config *getListConfig(const char* listname); /********** rfcparse.c **********/ struct Mail { char * Header; char * Body; char * Envelope; char * From; char * Subject; char * Reply_To; char * Message_Id; char * Approve; char * ListSignature; }; void RemoveCarrigeReturns(char *buffer); int isRFC822Address(const char *buffer); int ParseAddressLine(char *buffer); int ParseReplyToLine(char *buffer); int ParseFromLine(char *buffer); int ParseMessageIdLine(char *buffer); int ParseApproveLine(char *buffer); void CanonizeAddress(char **buffer, const char *fqdn); int ParseMail(struct Mail **result, char *incoming_mail, const char *fqdn); /********** io.c **********/ char *LoadFromDescriptor(int fd); char *loadfile(const char *filename); int savefile(const char *filename, const char *buffer); /********** archive.c **********/ int ArchiveMail(const struct Mail *MailStruct, const char *listname); /********** authen.c **********/ int FindBodyPassword(struct Mail *MailStruct); int isValidAdminPassword(const char *password, const char *listname); int isValidPostingPassword(const char *password, const char *listname); /********** filter.c **********/ int MailFilter(struct Mail *MailStruct, const char *filter); /********** acl.c **********/ int checkACL(struct Mail *, const char *, int *, char **, acl_type_t); enum { ACL_DROP, ACL_PASS, ACL_APPROVE, ACL_REDIRECT, ACL_FORWARD, ACL_REJECT, ACL_REJECTWITH, ACL_FILTER, ACL_NONE }; /********** handleacl.c **********/ int handleACL(struct Mail *MailStruct, const char *listname, int operation, char *parameter); /********** help.c **********/ int SendHelp(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); int Indecipherable(struct Mail *MailStruct, const char *defaultlist); /********** index.c **********/ int GenIndex(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); /********** io.c **********/ char *LoadFromDescriptor(int fd); char *loadfile(const char *filename); int savefile(const char *filename, const char *buffer); /********** listserv.c **********/ void listserv_main(char *incoming_mail, char *default_list); /********** approve.c **********/ void approve_main(char *incoming_mail); /********** mailer.c **********/ FILE *OpenMailer(const char *envelope, const char *recipients[]); FILE *vOpenMailer(const char *envelope, ... ); int CloseMailer(FILE * fh); int ListMail(const char *envelope, const char *listname, const struct Mail *MailStruct); /********** members.c **********/ int SendSubscriberList(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); /********** password.c **********/ int setPassword(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); const char *getPassword(void ); /********** tool.c **********/ char *buildFuzzyMatchAddress(const char *); int isValidListName(const char *); bool isSubscribed(const char *, const char *, char **, char **, bool); /********** unsubscribe.c **********/ int DeleteAddress(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); /********** hermes.c **********/ void hermes_main(char *incoming_mail, const char *listname); /********** subscribe.c **********/ int AddAddress(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); /********** parsearray.c **********/ struct Parse { const char * keyword; int (*handleCommand)(struct Mail *, const char *, const char *, const char *); }; extern struct Parse ParseArray[]; /********** generate-cookie.c **********/ char* generate_cookie(const char*); /********** queue-posting.c **********/ char* queue_posting(const struct Mail* mail, const char* listname); /********** queue-command.c **********/ char* queue_command(const struct Mail* mail, const char* command); /********** address-db.c **********/ int is_address_on_list(const char* file, const char* address); int add_address(const char* file, const char* address); #endif /* !defined(__PETIDOMO_H__) */ @ 1.20 log @Since we never tested the return codes of *_main() anyway, don't pretend we do: Made listsern_main(), hermes_main() and approve_main() officially return "void". @ text @d3 1 a3 1 $Revision: 1.19 $ d67 2 a68 1 char * acl_file; d81 6 d109 2 a110 1 char * acl_file; d167 1 a167 1 int checkACL(struct Mail *, const char *, int *, char **); @ 1.19 log @First bunch of cosmetic adjustments to text messages. Additionally --masterconf=FILE is also passed through to files created in acknowledge directory. @ text @d3 1 a3 1 $Revision: 1.18 $ d194 1 a194 1 int listserv_main(char *incoming_mail, char *default_list); d198 1 a198 1 int approve_main(char *incoming_mail); d228 1 a228 1 int hermes_main(char *incoming_mail, const char *listname); @ 1.18 log @Underscores in file names suck, because you need an extra key-press to type them compared to the hyphen. For this reason (and for consistency) I corrected this horrible, horrible mistake of the past and renamed those files. @ text @d3 1 a3 1 $Revision: 1.17 $ d54 1 d108 1 a108 1 int InitPetidomo(const char* masterconfig_path); @ 1.17 log @Petidomo needs to know the path to the executable in order to write the ack-spool file, which starts Petidomo again to process the acknowledged command or posting. I used BINDIR for that, but realized that this sucks when somebody manually moves the binary. Hence, I am using the contents of argv[0] now, normalized to an absolute path. This value is stored in the global variable who_am_i, which the queue_*() routines now use. @ text @d3 1 a3 1 $Revision: 1.16 $ a22 1 d242 1 a242 1 /********** generate_cookie.c **********/ d246 1 a246 1 /********** queue_posting.c **********/ d250 1 a250 1 /********** queue_command.c **********/ d254 1 a254 1 /********** address_db.c **********/ @ 1.16 log @As we agreed today, Petidomo is now open because licensed under GPL and always will be licensed under GPL, so use "Petidomo" as the program name everywhere and consistently. @ text @d3 1 a3 1 $Revision: 1.15 $ d54 1 @ 1.15 log @Implemented the acked-once feature. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/petidomo.h,v $ $Revision: 1.14 $ d7 1 a7 1 This file is part of OpenPetidomo. d9 1 a9 1 OpenPetidomo is free software; you can redistribute it and/or modify d14 1 a14 1 OpenPetidomo is distributed in the hope that it will be useful, but @ 1.14 log @Added new action keyword to the Access Control Language: approve. This keyword will -- unlike to "pass" -- not only pass the mail, but will also make sure that the mail passes all other authorization controls. This means, the mail will be treated as if the Petidomo master password had been given in the header. @ text @d3 1 a3 1 $Revision: 1.13 $ d253 5 @ 1.13 log @Implemented the approve mode, where incoming mails are searched for confirmation cookies and the apropriate queue entries will be executed. @ text @d3 1 a3 1 $Revision: 1.12 $ d163 1 @ 1.12 log @Had to make is_approved a global variable, because it is actually tested in subroutines of listserv_main() and hermes_main(), like subscribe(), which's parameter list I don't want to change. @ text @d3 1 a3 1 $Revision: 1.11 $ d193 4 @ 1.11 log @queue_command() and queue_posting() will now return the cookie used as filename, so that the calling code can mail back the request for confirmation. @ text @d3 1 a3 1 $Revision: 1.10 $ d51 4 d192 1 a192 1 int listserv_main(char *incoming_mail, char *default_list, char); d222 1 a222 1 int hermes_main(char *incoming_mail, const char *listname, char); @ 1.10 log @List's "AllowPublicSubscripiton" does not exist anymore. Now we have "SubscriptionType" with valid values "public", "admin" or "acknowledged". @ text @d3 1 a3 1 $Revision: 1.9 $ d239 1 a239 1 void queue_posting(const struct Mail* mail, const char* listname); d243 1 a243 1 void queue_command(const struct Mail* mail, const char* command); @ 1.9 log @Removed the whole concept of "alien subscription". It was stupid to begin with and now that we'll have acknowledged subscriptions, it is useless, too. @ text @d3 1 a3 1 $Revision: 1.8 $ d66 1 a66 1 enum d70 10 a79 1 LIST_MODERATED d85 1 a85 1 int allowpubsub; @ 1.8 log @Implemented spooling mechanism for requests and postings that need an acknowledgement to be processed. The code is there, it just isn't called yet. @ text @d3 1 a3 1 $Revision: 1.7 $ a76 1 int allowaliensub; @ 1.7 log @Added config entry "AcknowledgementFile" to the mailing list's config file. @ text @d3 1 a3 1 $Revision: 1.6 $ d60 1 d180 1 a180 1 int listserv_main(char *incoming_mail, char *default_list); d210 1 a210 1 int hermes_main(char *incoming_mail, const char *listname); d228 8 @ 1.6 log @Added generate_cookie() routine taken from mapSoN. @ text @d3 1 a3 1 $Revision: 1.5 $ d91 1 @ 1.5 log @Rewrote Petidomo so that virtually any file's path can be configured at run-time now. @ text @d3 1 a3 1 $Revision: 1.4 $ d222 4 @ 1.4 log @Petidomo will now expect its master config file at SYSCONFDIR/petidomo.conf. This location can be changed at run-time with the command line parameter --masterconf. @ text @d3 1 a3 1 $Revision: 1.3 $ d53 2 a54 1 struct PD_Config { d59 5 a63 1 }; d65 2 a66 1 enum { d70 1 a70 1 }; d72 2 a73 1 struct List_Config { a77 1 int showonindex; d84 8 a91 1 }; d99 2 a100 1 struct Mail { d110 1 a110 1 }; d145 2 a146 2 enum { d155 1 a155 1 }; d216 2 a217 1 struct Parse { d220 1 a220 1 }; @ 1.3 log @Replaced the old basedir-mechanism in Petidomo, which used to be the home directory of the petidomo user. Now, Petidomo expects its master config file in ETCDIR, which is '/etc' per default. All other paths will be set there at run-time. @ text @d3 1 a3 1 $Revision: 1.2 $ d80 3 a82 3 int InitPetidomo(void); const struct PD_Config *getMasterConfig(void ); const struct List_Config *getListConfig(const char *listname); @ 1.2 log @Reversed all changes concerning C++ in Petidomo ... it isn't worth the major rewrite. @ text @d3 1 a3 1 $Revision: 1.1 $ a53 1 char * basedir; @ 1.1 log @All internal prototypes and definitions. @ text @d2 2 a3 2 $Source$ $Revision$ a50 3 #include "libargv/argv.h" #include "debug.h" a58 2 int detach; int show_stats; a124 5 /********** exit.c **********/ void RescueMail(const char *mail); void RemoveRescueMail(void); a188 4 /********** signature.c **********/ void AppendSignature(FILE * fh); a192 4 /********** argvSetDebugLevel.c **********/ int argvSetDebugLevel(argv_array_t debug); d205 1 a205 2 int (*handleCommand)(struct Mail *, const char *, const char *, const char *); @