head 1.23; access; symbols PETIDOMO_4_0b6:1.23 PETIDOMO_4_0b5:1.23 PETIDOMO_4_0b4:1.23 PETIDOMO_4_0b3:1.23 BEFORETHL:1.20 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.23 date 2004.02.02.19.56.38; author thl; state Exp; branches; next 1.22; 1.22 date 2004.02.02.19.55.26; author thl; state Exp; branches; next 1.21; 1.21 date 2004.02.02.19.50.25; author thl; state Exp; branches; next 1.20; 1.20 date 2001.02.17.21.37.05; author simons; state Exp; branches; next 1.19; 1.19 date 2001.02.12.20.44.13; author simons; state Exp; branches; next 1.18; 1.18 date 2001.01.20.14.29.28; author simons; state Exp; branches; next 1.17; 1.17 date 2001.01.20.13.52.41; author rse; state Exp; branches; next 1.16; 1.16 date 2001.01.19.16.46.25; author simons; state Exp; branches; next 1.15; 1.15 date 2001.01.19.16.02.22; author simons; state Exp; branches; next 1.14; 1.14 date 2001.01.19.14.56.33; author rse; state Exp; branches; next 1.13; 1.13 date 2001.01.19.14.18.43; author simons; state Exp; branches; next 1.12; 1.12 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.11; 1.11 date 2001.01.16.11.33.36; author simons; state Exp; branches; next 1.10; 1.10 date 2001.01.16.10.45.21; author simons; state Exp; branches; next 1.9; 1.9 date 2001.01.15.19.18.49; author simons; state Exp; branches; next 1.8; 1.8 date 2001.01.15.17.23.25; author simons; state Exp; branches; next 1.7; 1.7 date 2001.01.15.17.06.48; author simons; state Exp; branches; next 1.6; 1.6 date 2001.01.15.16.27.52; 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.06.11.05.08; author simons; state Exp; branches; next 1.3; 1.3 date 2000.12.15.15.48.00; author simons; state Exp; branches; next 1.2; 1.2 date 2000.12.13.15.35.14; author simons; state Exp; branches; next 1.1; 1.1 date 2000.12.13.13.19.23; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.23; author simons; state Exp; branches; next ; desc @@ 1.23 log @merge in thl slpit cookie update from OpenPKG @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/hermes.c,v $ $Revision: 1.22 $ 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. */ #include #include #include #include "libtext/text.h" #include "petidomo.h" void hermes_main(char * incoming_mail, const char * listname) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig; struct stat sb; struct Mail * MailStruct; FILE * fh; char * PostingHeaders; char * currLine; char * nextLine; char * dst; char * parameter; char * buffer; char envelope[1024]; char owner[1024]; int rc, len, operation; assert(listname != NULL); /* Initialize internals. */ MasterConfig = getMasterConfig(); ListConfig = getListConfig(listname); /* Parse the incoming mail. */ rc = ParseMail(&MailStruct, incoming_mail, ListConfig->fqdn); if (rc != 0) { syslog(LOG_ERR, "Parsing the incoming mail failed."); exit(rc); } /* Do sanity checks. */ if (MailStruct->Envelope == NULL) { syslog(LOG_ERR, "Received mail without a valid envelope."); return; } if (MailStruct->From == NULL) { syslog(LOG_ERR, "Received mail without From: line."); return; } if (*MailStruct->Body == '\0') { syslog(LOG_INFO, "Received mail with empty body."); return; } /* Initialize internal stuff. */ if (isValidListName(listname) == FALSE) { syslog(LOG_ERR, "Mailing list \"%s\" does not exist.", listname); exit(1); } PostingHeaders = xmalloc(strlen(MailStruct->Header)+1024); sprintf(envelope, "%s-owner@@%s", listname, ListConfig->fqdn); sprintf(owner, "%s-owner@@%s", listname, ListConfig->fqdn); /* Check for authorization. */ if (FindBodyPassword(MailStruct) != 0) exit(1); if (isValidPostingPassword(MailStruct->Approve, listname) == FALSE) { /* If no valid posting password has been provided, the mail is subject to the ACL mechanism. Please note that the ACL may actually set a correct posting password via the 'approve' command. So just because there wasn't a valid posting password here, it doesn't mean there might not be after ACL processing is over. That's why we check the posting password again below. */ if (checkACL(MailStruct, listname, &operation, ¶meter, ACL_PRE) != 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; } } if (isValidPostingPassword(MailStruct->Approve, listname) == FALSE) { /* Reject the article, if the list is of type 'moderated'. */ if (ListConfig->listtype == LIST_MODERATED) { syslog(LOG_INFO, "\"%s\" tried to post to list \"%s\", but failed to " \ "provide a correct password.", MailStruct->From, listname); fh = vOpenMailer(envelope, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s (Petidomo Mailing List Server)\n", owner); fprintf(fh, "To: %s\n", owner); fprintf(fh, "Subject: Petidomo: BOUNCE %s@@%s: Moderator approval required\n", listname, ListConfig->fqdn); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); fprintf(fh, "The following posting requires your explicit approval:\n\n"); fprintf(fh, "%s\n", MailStruct->Header); fprintf(fh, "%s", MailStruct->Body); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); exit(-1); } return; } else if (ListConfig->listtype == LIST_CLOSED) { /* Only subscribers may post */ if (isSubscribed(listname, MailStruct->From, NULL, NULL, TRUE) == FALSE) { syslog(LOG_INFO, "\"%s\" tried to post to closed list \"%s\", but " \ "he is no subscriber.", MailStruct->From, listname); fh = vOpenMailer(envelope, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s (Petidomo Mailing List Server)\n", owner); fprintf(fh, "To: %s\n", owner); fprintf(fh, "Subject: Petidomo: BOUNCE %s@@%s: Non-member submission from \"%s\"\n", listname, ListConfig->fqdn, MailStruct->From); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); fprintf(fh, "The following posting was rejected, because the sender\n" \ "\"%s\" is not subscribed to the list:\n\n", MailStruct->From); fprintf(fh, "%s\n", MailStruct->Header); fprintf(fh, "%s", MailStruct->Body); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); exit(-1); } return; } } else if (ListConfig->listtype == LIST_ACKED && !g_is_approved) { /* Every posting needs an acknowledgement. */ char* cookie; char c; char* originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; syslog(LOG_INFO, "\"%s\" tried to post to acknowledged list \"%s\"; posting " \ "has been deferred.", MailStruct->From, listname); cookie = queue_posting(MailStruct, listname); fh = vOpenMailer(owner, originator, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo-approve@@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); fprintf(fh, "Your posting needs to be approved. Reply to this mail and\n"); fprintf(fh, "concatenate the two following strings to one large string\n"); fprintf(fh, "\n"); c = cookie[16]; cookie[16] = '\0'; fprintf(fh, " %s\n", &cookie[ 0]); cookie[16] = c; fprintf(fh, " %s\n", &cookie[16]); fprintf(fh, "\n"); fprintf(fh, "This validates your will to send and your will to read.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); exit(-1); } return; } else if (ListConfig->listtype == LIST_ACKED_ONCE) { /* First posting needs an acknowledgement. */ if (g_is_approved) { syslog(LOG_INFO, "\"%s\" acknowledged a former posting attempt on ack-once list \"%s\"; " \ "add him to the ack file and let the posting pass.", MailStruct->From, listname); rc = add_address(ListConfig->ack_file, MailStruct->From); if (rc < 0) { syslog(LOG_ERR, "Can't add address to ack file."); exit(-1); } } else { char* originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; rc = is_address_on_list(ListConfig->ack_file, MailStruct->From); if (rc == 0 && MailStruct->Reply_To) rc = is_address_on_list(ListConfig->ack_file, MailStruct->Reply_To); if (rc < 0) { syslog(LOG_ERR, "Can't verify whether address \"%s\" needs to be acknowledged or not.", MailStruct->From); exit(-1); } else if (rc == 0) { char* cookie; char c; syslog(LOG_INFO, "\"%s\" tried to post to ack-once list \"%s\", but is posting " \ "for the first time; posting has been deferred.", MailStruct->From, listname); cookie = queue_posting(MailStruct, listname); fh = vOpenMailer(owner, originator, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo-approve@@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); fprintf(fh, "Your posting needs to be approved. Reply to this mail and\n"); fprintf(fh, "concatenate the two following strings to one large string\n"); fprintf(fh, "\n"); c = cookie[16]; cookie[16] = '\0'; fprintf(fh, " %s\n", &cookie[ 0]); cookie[16] = c; fprintf(fh, " %s\n", &cookie[16]); fprintf(fh, "\n"); fprintf(fh, "This validates your will to send and your will to read.\n"); fprintf(fh, "You won't have to repeat that action in the future.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); exit(-1); } return; } else syslog(LOG_INFO, "\"%s\" tried to post to ack-once list \"%s\" and has been found in " \ "the ack file; letting posting pass.", MailStruct->From, listname); } } } /* 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. */ for(len = 0, currLine = MailStruct->Header, dst = PostingHeaders; *currLine != '\0'; currLine = nextLine) { /* Find next header line. */ nextLine = text_find_next_line(currLine); while (*nextLine == '\t' || *nextLine == ' ') nextLine = text_find_next_line(nextLine); /* Copy the current line into our own buffer. */ if (!strncasecmp(currLine, "From:", 5) || !strncasecmp(currLine, "To:", 3) || !strncasecmp(currLine, "Cc:", 3) || !strncasecmp(currLine, "Subject:", 8) || !strncasecmp(currLine, "Date:", 5) || !strncasecmp(currLine, "MIME-Version:", 13) || !strncasecmp(currLine, "Content-Type:", 13) || !strncasecmp(currLine, "Content-Transfer-Encoding:", 26) || !strncasecmp(currLine, "In-Reply-To:", 12) || !strncasecmp(currLine, "References:", 11) || !strncasecmp(currLine, "Message-Id:", 11) || !strncasecmp(currLine, "X-Spam-Flag:", 12) || !strncasecmp(currLine, "Keywords:", 11) || !strncasecmp(currLine, "Summary:", 11) || !strncasecmp(currLine, "Received:", 9)) { len = nextLine - currLine; memmove(dst, currLine, len); dst += len; } } /* Add a Reply-To: field. */ if (ListConfig->reply_to == NULL) len = sprintf(dst, "Reply-To: %s@@%s\n", listname, ListConfig->fqdn); else if (!strcasecmp(ListConfig->reply_to, "none")) { if (MailStruct->Reply_To != NULL) { /* Copy Reply-To: line from original header. */ for(len = 0, currLine = MailStruct->Header; *currLine != '\0'; currLine = nextLine) { nextLine = text_find_next_line(currLine); while (*nextLine == '\t' || *nextLine == ' ') nextLine = text_find_next_line(nextLine); if (!strncasecmp(currLine, "Reply-To:", 9)) { len = nextLine - currLine; memmove(dst, currLine, len); } } } else len = 0; } else { len = sprintf(dst, "Reply-To: %s\n", ListConfig->reply_to); } dst += len; /* Add a Sender: field. */ len = sprintf(dst, "Sender: %s\n", owner); dst += len; /* Add a Precedence: field. */ len = sprintf(dst, "Precedence: list\n"); dst += len; *dst = '\0'; /* Add custom headers if there are any. */ if (stat(ListConfig->header_file, &sb) == 0) { char* p = loadfile(ListConfig->header_file); if (p == NULL) { syslog(LOG_ERR, "Failed reading the header file for list \"%s\".", listname); exit(1); } strcpy(dst, p); dst += strlen(p); free(p); } /* Add the signature if there is one. */ if (stat(ListConfig->sig_file, &sb) == 0) { buffer = loadfile(ListConfig->sig_file); if (buffer == NULL) { syslog(LOG_ERR, "Failed reading the signature file for list \"%s\".", listname); exit(1); } MailStruct->ListSignature = buffer; } /* No more modifications will be made. Now copy the posting headers into the structure instead of the original ones. */ MailStruct->Header = PostingHeaders; /* Apply the posting filter. */ if (ListConfig->postingfilter != NULL) { rc = MailFilter(MailStruct, ListConfig->postingfilter); if (rc != 0) { syslog(LOG_ERR, "Postingfilter \"%s\" returned error %d while processing posting " \ "for list \"%s\".", ListConfig->postingfilter, rc, listname); exit(1); } } /* Deliver the article to all recipients. */ rc = ListMail(envelope, listname, MailStruct); if (rc != 0) { syslog(LOG_ERR, "The attempt to deliver the article to the subscribers failed."); exit(1); } syslog(LOG_INFO, "Posted article from \"%s\" to list \"%s\" successfully.", MailStruct->From, listname); /* Archive the article. */ ArchiveMail(MailStruct, listname); } @ 1.22 log @merge in OpenPKG X-Spam-Flag addition @ text @d3 1 a3 1 $Revision: 1.21 $ d191 1 d207 2 a208 2 fprintf(fh, "Your posting needs to be approved. Do this by replying\n"); fprintf(fh, "to this mail and citing the string\n"); d210 3 a212 1 fprintf(fh, " %s\n", cookie); d214 1 a214 1 fprintf(fh, "in your reply.\n"); d255 1 d271 2 a272 2 fprintf(fh, "Your posting needs to be approved. Do this by replying\n"); fprintf(fh, "to this mail and citing the string\n"); d274 3 a276 1 fprintf(fh, " %s\n", cookie); d278 2 a279 1 fprintf(fh, "in your reply. You won't have to do that again.\n"); @ 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 @d3 1 a3 1 $Revision: 1.20 $ d336 1 @ 1.20 log @Petidomo will now let the "keywords:" and "summary:" headers pass when posting to a list. These headers are uncommon but have been around for ages. @ text @d3 1 a3 1 $Revision: 1.19 $ d104 1 a104 1 if (checkACL(MailStruct, listname, &operation, ¶meter) != 0) d288 21 @ 1.19 log @Changed loglevel of sereval syslog() calls from NOTICE to INFO, because they do not really require the administrator's attention but are informational. @ text @d3 1 a3 1 $Revision: 1.18 $ d315 2 @ 1.18 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.17 $ d128 1 a128 1 syslog(LOG_NOTICE, "\"%s\" tried to post to list \"%s\", but failed to " \ d159 1 a159 1 syslog(LOG_NOTICE, "\"%s\" tried to post to closed list \"%s\", but " \ d193 1 a193 1 syslog(LOG_NOTICE, "\"%s\" tried to post to acknowledged list \"%s\"; posting " \ d228 1 a228 1 syslog(LOG_NOTICE, "\"%s\" acknowledged a former posting attempt on ack-once list \"%s\"; " \ d253 1 a253 1 syslog(LOG_NOTICE, "\"%s\" tried to post to ack-once list \"%s\", but is posting " \ d283 1 a283 1 syslog(LOG_NOTICE, "\"%s\" tried to post to ack-once list \"%s\" and has been found in " \ @ 1.17 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.16 $ d27 1 a27 2 int hermes_main(char * incoming_mail, const char * listname) d65 1 a65 1 return 0; d70 1 a70 1 return 0; d75 1 a75 1 return 0; d118 1 a118 1 return 0; d148 1 a148 1 return -1; d150 1 a150 1 return 0; d180 1 a180 1 return -1; d182 1 a182 1 return 0; d217 1 a217 1 return -1; d219 1 a219 1 return 0; d235 1 a235 1 return -1; d247 1 a247 1 return -1; d278 1 a278 1 return -1; d280 1 a280 1 return 0; a430 2 return 0; @ 1.16 log @Changed ACL semantics: The ACL is processed only if the posting didn't have a valid password. If it did, the mail is going through in any case and the ACL is not tested. @ text @d3 1 a3 1 $Revision: 1.15 $ d203 1 a203 1 fprintf(fh, "Subject: Petidomo: CONFIRM %s@@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); d207 1 a207 1 fprintf(fh, "Your posting needs to be confirmed. Do this by replying\n"); d263 1 a263 1 fprintf(fh, "Subject: Petidomo: CONFIRM %s@@%s: Your posting to list \"%s\"\n", d268 1 a268 1 fprintf(fh, "Your posting needs to be confirmed. Do this by replying\n"); @ 1.15 log @Petidomo used the mail's envelope to deliver the request for confirmation. I have changed this to either reply-to or from (if reply-to is unset), because sendmail will destroy the original envelope under obscure circumstances. @ text @d3 1 a3 1 $Revision: 1.14 $ d95 1 a95 7 if (checkACL(MailStruct, listname, &operation, ¶meter) != 0) { syslog(LOG_ERR, "checkACL() failed with an error."); exit(1); } rc = handleACL(MailStruct, listname, operation, parameter); switch(rc) d97 11 a107 2 case -1: syslog(LOG_ERR, "handleACL() failed with an error."); d109 12 a120 4 case 0: break; case 1: return 0; d125 1 a125 2 /* No valid password found. Reject the article, if the list is of type 'moderated'. */ @ 1.14 log @Get rid of all complaints from GCC 2.97 (except for two things which I do not want to change on my own) @ text @d3 1 a3 1 $Revision: 1.13 $ d182 1 d188 1 a188 1 fh = vOpenMailer(owner, MailStruct->Envelope, NULL); d192 1 a192 1 fprintf(fh, "To: %s\n", MailStruct->Envelope); d231 1 d233 2 a234 2 if (rc == 0) rc = is_address_on_list(ListConfig->ack_file, MailStruct->Envelope); d248 1 a248 1 fh = vOpenMailer(owner, MailStruct->Envelope, NULL); d252 1 a252 1 fprintf(fh, "To: %s\n", MailStruct->Envelope); @ 1.13 log @Greatly enhanced the log messages Petidomo writes. Made the existing messages more helpful, added lots of new ones, generally made things real perfect. Remember: Life is BEAUTIFUL. @ text @d3 1 a3 1 $Revision: 1.12 $ a217 2 int rc; d230 1 a230 1 int rc = is_address_on_list(ListConfig->ack_file, MailStruct->From); @ 1.12 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.11 $ d65 1 a65 1 syslog(LOG_NOTICE, "Received mail without a valid envelope."); d70 1 a70 1 syslog(LOG_NOTICE, "Received mail without From: line."); d75 1 a75 1 syslog(LOG_NOTICE, "Received mail with empty body."); d147 1 d150 3 d181 6 a186 1 char* cookie = queue_posting(MailStruct, listname); d218 6 a223 1 int rc = add_address(ListConfig->ack_file, MailStruct->From); d242 6 a247 1 char* cookie = queue_posting(MailStruct, listname); d273 3 @ 1.11 log @Implemented the acked-once feature. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/hermes.c,v $ $Revision: 1.10 $ 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.10 log @Moved the call to checkACL() before anything else is tested regarding authorization. Combined with the new "approve" action in the ACL file, this allows to pass all other authentication mechanisms with the ACL. @ text @d3 1 a3 1 $Revision: 1.9 $ d201 54 @ 1.9 log @Added code that will request confirmation when posting to a list that is set to "acknowledged". @ text @d3 1 a3 1 $Revision: 1.8 $ d49 1 a86 1 MasterConfig = getMasterConfig(); d95 17 a200 17 } if (checkACL(MailStruct, listname, &operation, ¶meter) != 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 0; @ 1.8 log @Cosmetic change: Reformatted the source. @ text @d3 1 a3 1 $Revision: 1.7 $ d127 1 a127 1 if (ListConfig->listtype == LIST_CLOSED) d154 30 @ 1.7 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.6 $ d29 1 a29 1 { d54 2 a55 1 if (rc != 0) { d58 1 a58 1 } d62 2 a63 1 if (MailStruct->Envelope == NULL) { d66 3 a68 2 } if (MailStruct->From == NULL) { d71 3 a73 2 } if (*MailStruct->Body == '\0') { d76 1 a76 1 } d80 2 a81 1 if (isValidListName(listname) == FALSE) { d84 1 a84 1 } d93 1 a93 3 exit(1); if (isValidPostingPassword(MailStruct->Approve, listname) == FALSE) { d95 2 d100 2 a101 1 if (ListConfig->listtype == LIST_MODERATED) { d103 1 a103 1 "provide a correct password.", MailStruct->From, listname); d106 2 a107 1 if (fh != NULL) { d118 4 a121 4 } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); d123 2 a125 2 return 0; } d127 2 a128 1 if (ListConfig->listtype == LIST_CLOSED) { d130 2 a131 1 if (isSubscribed(listname, MailStruct->From, NULL, NULL, TRUE) == FALSE) { d133 2 a134 1 if (fh != NULL) { d146 4 a149 4 } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning this request.", owner); d151 2 a153 1 return 0; a154 1 } d156 2 a157 1 if (checkACL(MailStruct, listname, &operation, ¶meter) != 0) { d160 1 a160 1 } d162 10 a171 8 switch(rc) { case -1: syslog(LOG_ERR, "handleACL() failed with an error."); exit(1); case 0: break; case 1: return 0; a172 1 } d179 2 a180 2 currLine = nextLine) { d185 1 a185 1 nextLine = text_find_next_line(nextLine); d200 2 a201 1 !strncasecmp(currLine, "Received:", 9)) { d205 1 a206 1 } d211 5 a215 4 len = sprintf(dst, "Reply-To: %s@@%s\n", listname, ListConfig->fqdn); else if (!strcasecmp(ListConfig->reply_to, "none")) { if (MailStruct->Reply_To != NULL) { d220 2 a221 1 currLine = nextLine) { d225 1 a225 1 nextLine = text_find_next_line(nextLine); d227 2 a228 1 if (!strncasecmp(currLine, "Reply-To:", 9)) { d231 1 d233 1 d235 2 a236 1 d238 2 a239 4 else len = 0; } else { d241 1 a241 1 } d272 2 a273 1 if (stat(ListConfig->sig_file, &sb) == 0) { d275 2 a276 1 if (buffer == NULL) { d279 2 a281 2 MailStruct->ListSignature = buffer; } d290 2 a291 1 if (ListConfig->postingfilter != NULL) { d293 2 a294 1 if (rc != 0) { d296 1 a296 1 "for list \"%s\".", ListConfig->postingfilter, rc, listname); d298 1 a299 1 } d304 2 a305 1 if (rc != 0) { d308 1 a308 1 } d311 1 a311 1 MailStruct->From, listname); d318 1 a318 1 } @ 1.6 log @Added --approved command line parameter, which is treated as a boolean. Whether it is set or not will be passed through to listserv_main() and to hermes_main(). The parameter will be used by the spooling mechanism. @ text @d3 1 a3 1 $Revision: 1.5 $ d28 1 a28 1 hermes_main(char * incoming_mail, const char * listname, char is_approved) @ 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 $ d28 1 a28 1 hermes_main(char * incoming_mail, const char * listname) @ 1.4 log @- Added a "Petidomo:" prefix to all subject lines, to distinguish them from regular mail. Rejection mails furthermore have the prefix "BOUNCE :", mails that need approval have the prefix "APROVE :". - When a mail is rejected due to ACL, the mail body will tell you whether the global acl file or the list's local acl file hit. - If a file "lists//header" exists, it contents will be added to the headers of the article posted to the list. Be careful not to have blank lines in there, as this will screw the whole message up. - When generating the index of available mailing lists, the list type will now be typeset in brackets, e.g.: "(public mailing list)". - The index will no longer contain tabs in the mail body. @ text @d3 1 a3 1 $Revision: 1.3 $ d238 1 a238 1 /* Add custom headers if there are some. */ d240 1 a240 2 buffer = text_easy_sprintf("lists/%s/header", listname); if (stat(buffer, &sb) == 0) d242 1 a242 1 char* p = loadfile(buffer); a250 1 free(buffer); d255 2 a256 3 buffer = text_easy_sprintf("lists/%s/signature", listname); if (stat(buffer, &sb) == 0) { buffer = loadfile(buffer); @ 1.3 log @ - Removed all debugging code. Now that Petidomo will be "rewritten" in C++, I need a new paradigm for debugging anyway and the old solution of mine was to messy for my taste anyway. - Petidomo no longer cares under what name it has been started. The different modes of operation will now be distinguished by a mandatory command line parameter. @ text @d3 1 a3 1 $Revision: 1.2 $ d103 1 a103 1 fprintf(fh, "Subject: Unauthorized posting to list \"%s\"\n", listname); d107 1 a107 1 fprintf(fh, "The following article was rejected:\n\n"); d127 1 a127 1 fprintf(fh, "Subject: Unauthorized posting to list \"%s\"\n", listname); d131 1 a131 1 fprintf(fh, "The following article was rejected, because the sender\n" \ d237 17 @ 1.2 log @ - Added correct GNU GPL copyright statements to the files. - Removed unnecessary include statements. @ text @d2 2 a3 2 $Source$ $Revision$ a45 1 debug((DEBUG_HERMES, 5, "Received article for the \"%s\" mailing list", listname)); a58 2 debug((DEBUG_HERMES, 3, "Parsed incoming mail successfully.")); a86 2 debug((DEBUG_HERMES, 5, "Checking whether posting is authorized.")); a122 3 debug((DEBUG_HERMES, 5, "\"%s\" is not a subscriber of \"%s\". Rejecting.", MailStruct->From, listname)); a150 1 debug((DEBUG_HERMES, 8, "handleACL() returned %d.", rc)); a159 6 debug((DEBUG_HERMES, 3, "\"%s\" is authorized to post to \"%s\".", MailStruct->From, listname)); } else { debug((DEBUG_HERMES, 5, "Listtype doesn't require authorization.")); a164 1 debug((DEBUG_HERMES, 9, "Preparing headers for posting.")); a191 1 debug((DEBUG_HERMES, 9, "Copied line.")); a240 1 debug((DEBUG_HERMES, 6, "Checking whether \"%s\" exists.", buffer)); a241 1 debug((DEBUG_HERMES, 3, "Appending signature \"%s\".", buffer)); a247 1 debug((DEBUG_HERMES, 7, "Signature is: \"%s\".", buffer)); a248 2 else debug((DEBUG_HERMES, 3, "No signature file \"%s\".", buffer)); a257 1 debug((DEBUG_HERMES, 3, "Applying posting filter for list \"%s\".", listname)); a263 1 debug((DEBUG_HERMES, 6, "Filter was successful: returncode = %d.", rc)); @ 1.1 log @Initial revision @ text @d2 17 a18 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/hermes.c,v $ * $Revision: 1.40 $ * $Date: 1997/12/07 14:00:25 $ * * Copyright (C) 1996 by CyberSolutions GmbH. * All rights reserved. */ a19 1 #include d22 1 d24 2 a25 2 #include #include d64 4 @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@