Index: ossp-pkg/petidomo/acl.y RCS File: /v/ossp/cvs/ossp-pkg/petidomo/acl.y,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/petidomo/acl.y,v' 2>/dev/null --- acl.y 2001/01/20 13:42:01 1.11 +++ acl.y 2004/02/02 19:50:25 1.12 @@ -235,7 +235,8 @@ int checkACL(struct Mail * MailStruct, const char * listname, int * operation_ptr, - char ** parameter_ptr) + char ** parameter_ptr, + acl_type_t type) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig; @@ -256,15 +257,17 @@ /* First check the mail against the master acl file. */ - yyin = fopen(MasterConfig->acl_file, "r"); + yyin = fopen((type == ACL_PRE ? MasterConfig->acl_file_pre : MasterConfig->acl_file_post), "r"); if (yyin == NULL) { switch(errno) { case ENOENT: /* no master acl file */ - syslog(LOG_WARNING, "You have no global acl file (%s). This is probably not a good idea.", MasterConfig->acl_file); + syslog(LOG_WARNING, "You have no global acl file (%s). This is probably not a good idea.", + (type == ACL_PRE ? MasterConfig->acl_file_pre : MasterConfig->acl_file_post)); goto check_local_acl_file; default: - syslog(LOG_ERR, "Couldn't open \"%s\" acl file: %s", MasterConfig->acl_file, strerror(errno)); + syslog(LOG_ERR, "Couldn't open \"%s\" acl file: %s", + (type == ACL_PRE ? MasterConfig->acl_file_pre : MasterConfig->acl_file_post), strerror(errno)); return -1; } } @@ -277,7 +280,8 @@ yyin = NULL; } if (rc != 0) { - syslog(LOG_ERR, "Parsing \"%s\" file returned with an error.", MasterConfig->acl_file); + syslog(LOG_ERR, "Parsing \"%s\" file returned with an error.", + (type == ACL_PRE ? MasterConfig->acl_file_pre : MasterConfig->acl_file_post)); return -1; } @@ -301,14 +305,16 @@ lineno = 1; operation = ACL_NONE; ListConfig = getListConfig(listname); - yyin = fopen(ListConfig->acl_file, "r"); + yyin = fopen((type == ACL_PRE ? ListConfig->acl_file_pre : ListConfig->acl_file_post), "r"); if (yyin == NULL) { switch(errno) { case ENOENT: /* no list acl file */ goto finished; default: - syslog(LOG_ERR, "Couldn't open acl file \"%s\": %s", ListConfig->acl_file, strerror(errno)); + syslog(LOG_ERR, "Couldn't open acl file \"%s\": %s", + (type == ACL_PRE ? ListConfig->acl_file_pre : ListConfig->acl_file_post), + strerror(errno)); return -1; } } @@ -317,7 +323,8 @@ fclose(yyin); yyin = NULL; if (rc != 0) { - syslog(LOG_ERR, "Parsing \"%s\" file returned with an error.", ListConfig->acl_file); + syslog(LOG_ERR, "Parsing \"%s\" file returned with an error.", + (type == ACL_PRE ? ListConfig->acl_file_pre : ListConfig->acl_file_post)); return -1; } Index: ossp-pkg/petidomo/config-files.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/config-files.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/petidomo/config-files.c,v' 2>/dev/null --- config-files.c 2001/02/12 19:23:15 1.4 +++ config-files.c 2004/02/02 19:50:25 1.5 @@ -38,7 +38,8 @@ static char* mta = NULL; static char* mta_options = "-i -f%s"; static char* help_file = DATADIR "/help"; -static char* acl_file = SYSCONFDIR "/petidomo.acl"; +static char* acl_file_pre = SYSCONFDIR "/petidomo.acl-pre"; +static char* acl_file_post = SYSCONFDIR "/petidomo.acl-post"; static char* index_file = LOCALSTATEDIR "/index"; static char* list_dir = LOCALSTATEDIR "/lists"; static char* ack_queue_dir = LOCALSTATEDIR "/ack-queue"; @@ -56,7 +57,8 @@ { "MTA", CF_STRING, &mta }, { "MTAOptions", CF_STRING, &mta_options }, { "HelpFile", CF_STRING, &help_file }, - { "AclFile", CF_STRING, &acl_file }, + { "AclFilePre", CF_STRING, &acl_file_pre }, + { "AclFilePost", CF_STRING, &acl_file_post }, { "IndexFile", CF_STRING, &index_file }, { "ListDirectory", CF_STRING, &list_dir }, { "AckQueueDirectory", CF_STRING, &ack_queue_dir }, @@ -115,7 +117,8 @@ MasterConfig->mta = mta; MasterConfig->mta_options = mta_options; MasterConfig->help_file = help_file; - MasterConfig->acl_file = acl_file; + MasterConfig->acl_file_pre = acl_file_pre; + MasterConfig->acl_file_post = acl_file_post; MasterConfig->index_file = index_file; MasterConfig->list_dir = list_dir; MasterConfig->ack_queue_dir = ack_queue_dir; @@ -142,7 +145,8 @@ static char* sig_file; static char* desc_file; static char* header_file; -static char* list_acl_file; +static char* list_acl_file_pre; +static char* list_acl_file_post; static char* address_file; static char* ack_file; @@ -172,7 +176,8 @@ { "SignatureFile", CF_STRING, &sig_file }, { "DescriptionFile", CF_STRING, &desc_file }, { "HeaderFile", CF_STRING, &header_file }, - { "ACLFile", CF_STRING, &list_acl_file }, + { "ACLFilePre", CF_STRING, &list_acl_file_pre }, + { "ACLFilePost", CF_STRING, &list_acl_file_post }, { "AddressFile", CF_STRING, &address_file }, { "AcknowledgementFile", CF_STRING, &ack_file }, { NULL, 0, NULL} @@ -193,7 +198,8 @@ sig_file = "signature"; desc_file = "description"; header_file = "header"; - list_acl_file = "acl"; + list_acl_file_pre = "acl-pre"; + list_acl_file_post = "acl-post"; address_file = "list"; ack_file = "acks"; @@ -301,7 +307,8 @@ EXPAND(desc_file, desc_file); EXPAND(sig_file, sig_file); EXPAND(header_file, header_file); - EXPAND(acl_file, list_acl_file); + EXPAND(acl_file_pre, list_acl_file_pre); + EXPAND(acl_file_post, list_acl_file_post); EXPAND(address_file, address_file); EXPAND(ack_file, ack_file); Index: ossp-pkg/petidomo/hermes.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/hermes.c,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/petidomo/hermes.c,v' 2>/dev/null --- hermes.c 2001/02/17 21:37:05 1.20 +++ hermes.c 2004/02/02 19:50:25 1.21 @@ -101,7 +101,7 @@ processing is over. That's why we check the posting password again below. */ - if (checkACL(MailStruct, listname, &operation, ¶meter) != 0) + if (checkACL(MailStruct, listname, &operation, ¶meter, ACL_PRE) != 0) { syslog(LOG_ERR, "checkACL() failed with an error."); exit(1); @@ -286,6 +286,27 @@ } } + /* additional ACL check */ + if (isValidPostingPassword(MailStruct->Approve, listname) == FALSE) + { + if (checkACL(MailStruct, listname, &operation, ¶meter, ACL_POST) != 0) + { + syslog(LOG_ERR, "checkACL() failed with an error."); + exit(1); + } + rc = handleACL(MailStruct, listname, operation, parameter); + switch(rc) + { + case -1: + syslog(LOG_ERR, "handleACL() failed with an error."); + exit(1); + case 0: + break; + case 1: + return; + } + } + /* Copy the desired headers from the original mail to our own buffer. */ Index: ossp-pkg/petidomo/listserv.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/listserv.c,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/petidomo/listserv.c,v' 2>/dev/null --- listserv.c 2001/02/12 20:44:13 1.8 +++ listserv.c 2004/02/02 19:50:25 1.9 @@ -64,7 +64,21 @@ /* Do access control. */ - if (checkACL(MailStruct, NULL, &operator, ¶meter) != 0) { + if (checkACL(MailStruct, NULL, &operator, ¶meter, ACL_PRE) != 0) { + syslog(LOG_ERR, "checkACL() failed with an error."); + exit(1); + } + rc = handleACL(MailStruct, NULL, operator, parameter); + switch(rc) { + case -1: + syslog(LOG_ERR, "handleACL() failed with an error."); + exit(1); + case 0: + break; + case 1: + return; + } + if (checkACL(MailStruct, NULL, &operator, ¶meter, ACL_POST) != 0) { syslog(LOG_ERR, "checkACL() failed with an error."); exit(1); } Index: ossp-pkg/petidomo/petidomo.h RCS File: /v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v' 2>/dev/null --- petidomo.h 2001/01/20 14:29:28 1.20 +++ petidomo.h 2004/02/02 19:50:25 1.21 @@ -64,7 +64,8 @@ char * list_dir; char * ack_queue_dir; char * help_file; - char * acl_file; + char * acl_file_pre; + char * acl_file_post; char * index_file; }; @@ -77,6 +78,12 @@ LIST_ACKED_ONCE }; +typedef enum + { + ACL_PRE, + ACL_POST + } acl_type_t; + enum subscription_type_t { SUBSCRIPTION_PUBLIC, @@ -99,7 +106,8 @@ char * desc_file; char * sig_file; char * header_file; - char * acl_file; + char * acl_file_pre; + char * acl_file_post; char * list_dir; char * address_file; char * ack_file; @@ -156,7 +164,7 @@ /********** acl.c **********/ -int checkACL(struct Mail *, const char *, int *, char **); +int checkACL(struct Mail *, const char *, int *, char **, acl_type_t); enum { ACL_DROP, Index: ossp-pkg/petidomo/version.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/version.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/version.c,v' 2>/dev/null --- version.c 2001/01/19 15:01:19 1.1 +++ version.c 2004/02/02 19:50:25 1.2 @@ -8,7 +8,7 @@ #ifndef _VERSION_C_ #define _VERSION_C_ -#define PETIDOMO_VERSION 0x400101 +#define PETIDOMO_VERSION 0x400102 typedef struct { const int v_hex; @@ -32,13 +32,13 @@ #undef _VERSION_C_AS_HEADER_ petidomo_version_t petidomo_version = { - 0x400101, - "4.0b1", - "4.0b1 (18-Jan-2001)", - "This is Petidomo, Version 4.0b1 (18-Jan-2001)", - "Petidomo 4.0b1 (18-Jan-2001)", - "Petidomo/4.0b1", - "@(#)Petidomo 4.0b1 (18-Jan-2001)", + 0x400102, + "4.0b2", + "4.0b2 (24-Apr-2002)", + "This is Petidomo, Version 4.0b2 (24-Apr-2002)", + "Petidomo 4.0b2 (24-Apr-2002)", + "Petidomo/4.0b2", + "@(#)Petidomo 4.0b2 (24-Apr-2002)", "$Id$" };