head 1.21; access; symbols PETIDOMO_4_0b6:1.21 PETIDOMO_4_0b5:1.20 PETIDOMO_4_0b4:1.20 PETIDOMO_4_0b3:1.20 BEFORETHL:1.20 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.21 date 2004.03.19.15.39.21; author thl; state Exp; branches; next 1.20; 1.20 date 2001.01.20.15.03.11; author rse; 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.19.14.56.33; author rse; state Exp; branches; next 1.17; 1.17 date 2001.01.19.14.28.08; author simons; state Exp; branches; next 1.16; 1.16 date 2001.01.19.14.18.43; author simons; state Exp; branches; next 1.15; 1.15 date 2001.01.19.13.31.11; author simons; state Exp; branches; next 1.14; 1.14 date 2001.01.18.20.30.50; author rse; state Exp; branches; next 1.13; 1.13 date 2001.01.16.12.09.12; author simons; state Exp; branches; next 1.12; 1.12 date 2001.01.16.11.57.51; author simons; state Exp; branches; next 1.11; 1.11 date 2001.01.15.17.56.33; 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.07; author simons; state Exp; branches; next 1.8; 1.8 date 2001.01.11.14.10.57; author simons; state Exp; branches; next 1.7; 1.7 date 2001.01.10.17.12.40; author simons; state Exp; branches; next 1.6; 1.6 date 2001.01.08.20.36.19; author simons; state Exp; branches; next 1.5; 1.5 date 2001.01.06.11.05.08; author simons; state Exp; branches; next 1.4; 1.4 date 2000.12.15.16.16.07; 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.25; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.25; author simons; state Exp; branches; next ; desc @@ 1.21 log @split cookies on (un)subscription, too - found and fixed by tho @ text @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,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. */ #include #include #include "libtext/text.h" #include "petidomo.h" int DeleteAddress(struct Mail * MailStruct, const char * param1, const char * param2, const char * defaultlist) { const struct PD_Config * MasterConfig; const struct List_Config * ListConfig; FILE * fh; const char * address = NULL; const char * listname = NULL; char owner[4096]; char envelope[4096]; char * buffer; char * originator; char * p; char * list; /* Initialize internal stuff from master config file. */ MasterConfig = getMasterConfig(); sprintf(envelope, "petidomo-manager@@%s", MasterConfig->fqdn); originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; /* Try to find out, which parameter is what. */ if (param1 != NULL) { if (isValidListName(param1) == TRUE) listname = param1; else if (isRFC822Address(param1) == TRUE) address = param1; if (param2 != NULL) { if (listname == NULL && isValidListName(param2) == TRUE) listname = param2; else if (address == NULL && isRFC822Address(param2) == TRUE) address = param2; } } if (address == NULL) address = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; assert(address != NULL); if (listname == NULL) { if (defaultlist != NULL) listname = defaultlist; else { syslog(LOG_INFO, "%s: unsubscribe-command invalid: No list specified.", MailStruct->From); fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo@@%s (Petidomo Mailing List Server)\n", MasterConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s\"\n", address); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); buffer = text_easy_sprintf("You tried to unsubscribe the address \"%s\" from a mailing list. " \ "Unfortunately, your request could not be processed, because " \ "you did not specify a valid mailing list name from which the " \ "address should be unsubscribed. You may use the command INDEX " \ "to receive an overview of the available mailing lists. Also, " \ "use the command HELP to verify that you got the command syntax " \ "right.", address); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); CloseMailer(fh); } else syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); return 0; } } /* Initialize internal stuff again from list config. */ ListConfig = getListConfig(listname); sprintf(owner, "%s-owner@@%s", listname, ListConfig->fqdn); sprintf(envelope, "%s-owner@@%s", listname, ListConfig->fqdn); /* Check whether the request is authorized at all. */ if (isValidAdminPassword(getPassword(), listname) == FALSE) { /* No valid password, check further. */ if (ListConfig->subtype == SUBSCRIPTION_ADMIN) { /* Access was unauthorized, notify the originator. */ syslog(LOG_INFO, "%s: Attempt to unsubscribe \"%s\" from list \"%s\" rejected due to lack of " \ "a correct admin password.", MailStruct->From, address, listname); fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); buffer = text_easy_sprintf("The mailing list \"%s\" is a closed forum and only the maintainer may " \ "unsubscribe addresses. Your request has been forwarded to the " \ "appropriate person, so please don't send any further mail. You will " \ "be notified as soon as possible.", listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); CloseMailer(fh); } else syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); /* Notify the owner. */ fh = vOpenMailer(envelope, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", owner); fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Unauthorized request from \"%s\"\n", listname, ListConfig->fqdn, originator); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); buffer = text_easy_sprintf("\"%s\" tried to unsubscribe the address \"%s\" from the \"%s\" mailing list, " \ "but couldn't provide the correct password. To unsubscribe him, send the " \ "following commands to the server:", originator, address, listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n\n", buffer); fprintf(fh, "password \n"); fprintf(fh, "unsubscribe %s %s\n", address, listname); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); return -1; } return 0; } } /* Okay, remove the address from the list. */ if (isSubscribed(listname, address, &list, &p, FALSE) == FALSE) { syslog(LOG_INFO, "%s: Attempt to unsubscribe \"%s\" from list \"%s\" rejected, because the " \ "address is not on the list.", MailStruct->From, address, listname); /* Notify the originator, that the address is not subscribed at all. */ fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); fprintf(fh, "The address is not subscribed to this list.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); return -1; } } else { if (isValidAdminPassword(getPassword(), listname) == FALSE && ListConfig->subtype == SUBSCRIPTION_ACKED && !g_is_approved) { /* Require approval. */ char* command; char c; char* cookie; syslog(LOG_INFO, "%s: Attempt to unsubscribe \"%s\" from list \"%s\" deferred, because the " \ "request must be acknowledged first.", MailStruct->From, address, listname); command = text_easy_sprintf("unsubscribe %s %s", address, listname); cookie = queue_command(MailStruct, command); /* Send request for approval to the user. */ fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo-approve@@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", address); if (strcasecmp(address, originator) == 0) fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Your request \"subscribe %s\"\n", listname, ListConfig->fqdn, listname); else fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Request \"subscribe %s\" from \"%s\"\n", listname, ListConfig->fqdn, listname, originator); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); if (strcasecmp(address, originator) == 0) buffer = text_easy_sprintf("You requested that the address \"%s\" should be unsubscribed from " \ "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and concatenating the following two strings into one", originator, address, listname); else buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be unsubscribed from " \ "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and concatenating the following two strings into one", originator, address, listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); 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, "in your reply.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); return -1; } /* If the request for approval has been sent to an address different to that of the originator, notify him what happened. */ if (strcasecmp(address, originator) == 0) { fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); fprintf(fh, "Unsubscribing the address \"%s\" from the list \"%s\"\n", address, listname); fprintf(fh, "requires additional approval by \"%s\". A request\n", address); fprintf(fh, "has been sent to this address. We are now awaiting the approval.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); return -1; } } return 0; } syslog(LOG_INFO, "%s: Okay; unsubscribing address \"%s\" from list \"%s\".", MailStruct->From, address, listname); fh = fopen(ListConfig->address_file, "w"); if (fh == NULL) { syslog(LOG_ERR, "Failed to open file \"%s\" for writing: %s", ListConfig->address_file, strerror(errno)); return -1; } *p++ = '\0'; fprintf(fh, "%s", list); p = text_find_next_line(p); /* skip address in question */ fprintf(fh, "%s", p); fclose(fh); /* Send success notification to the originator and the unsubscribed address */ if (!strcasecmp(address, originator) == TRUE) fh = vOpenMailer(envelope, address, NULL); else fh = vOpenMailer(envelope, address, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", address); if (strcasecmp(address, originator) == TRUE) fprintf(fh, "Cc: %s\n", originator); fprintf(fh, "Subject: Petidomo: Request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); if (!strcasecmp(address, originator) == TRUE) { buffer = text_easy_sprintf( "Per your request, the address \"%s\" has been unsubscribed from the " \ "\"%s\" mailing list.\n\n", address, listname); } else { buffer = text_easy_sprintf( "Per request from \"%s\", the address \"%s\" has been unsubscribed from the " \ "\"%s\" mailing list.\n\n", originator, address, listname); } text_wordwrap(buffer, 70); fprintf(fh, "%s", buffer); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", address); return -1; } } /* Send success notification to the list owner */ fh = vOpenMailer(envelope, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", owner); fprintf(fh, "Subject: Petidomo: UNSUBSCRIBE %s@@%s: %s\n", listname, ListConfig->fqdn, address); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); if (!strcasecmp(address, originator) == TRUE) { buffer = text_easy_sprintf( "Per request from the subscriber, the address \"%s\"\n" "has been unsubscribed from the \"%s\" mailing list.\n", address, listname, ListConfig->fqdn); } else { buffer = text_easy_sprintf( "Per request from \"%s\", the address \"%s\"\n" "has been unsubscribed from the \"%s\" mailing list.\n", originator, address, listname, ListConfig->fqdn); } text_wordwrap(buffer, 75); fprintf(fh, "%s\n", buffer); fprintf(fh, "No action is required on your part.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); return -1; } free(list); return 0; } @ 1.20 log @Sorry, I still inist that Petidomo visually resembles Majordomo as close as possible: now Petidomo no longer just sends a carbon-copy of the final "successful" mail after subscribe/unsubscribe operations to the list owner. Instead the list owner gets an own dedicated mail. The most important thing is that those mails have "SUBSCRIBE" and "UNSUBSCRIBE" tags in their Subject so one can easily monitor those operations as the list owner. @ text @d3 1 a3 1 $Revision: 1.19 $ d221 1 d247 1 a247 1 "request by replying to this mail and citing the string", d252 1 a252 1 "request by replying to this mail and citing the string", d255 6 a260 2 fprintf(fh, "%s\n", buffer); fprintf(fh, "\n %s\n\n", cookie); @ 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 $ d311 1 a311 2 /* Send success notification to the originator, and the unsubscribed address. */ d314 1 a314 1 fh = vOpenMailer(envelope, address, owner, NULL); d316 1 a316 1 fh = vOpenMailer(envelope, address, originator, owner, NULL); d322 2 a323 4 if (!strcasecmp(address, originator) == TRUE) fprintf(fh, "Cc: %s\n", owner); else fprintf(fh, "Cc: %s, %s\n", originator, owner); d348 1 a348 1 syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); d352 36 @ 1.18 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.17 $ d92 1 a92 1 "you didn't specify a valid mailing list name from which the " \ d94 1 a94 1 "to receive an overview over the available mailing lists. Also, " \ d218 1 a218 1 /* Require confirmation. */ d229 1 a229 1 /* Send request for confirmation to the user. */ d236 4 a239 1 fprintf(fh, "Subject: Petidomo: CONFIRM %s@@%s: Request from \"%s\"\n", listname, ListConfig->fqdn, originator); d245 1 a245 1 "the mailing list \"%s\". This will not happen unless you confirm the " \ d250 1 a250 1 "the mailing list \"%s\". This will not happen unless you confirm the " \ d265 1 a265 1 /* If the request for confirmation has been sent to an d282 3 a284 2 fprintf(fh, "Unsubscribing the address will need confirmation. Such a\n"); fprintf(fh, "request has been sent to the address already, so don't move!\n"); @ 1.17 log @Fixed the spelling of the newly added syslog messages. @ text @d3 1 a3 1 $Revision: 1.16 $ d21 2 d298 1 a298 1 syslog(LOG_ERR, "Failed to open file \"%s\" for writing: %m", ListConfig->address_file); @ 1.16 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.15 $ d182 1 a182 1 syslog(LOG_INFO, "%s: Attempt to unsubscribe \"%s\" from list \"%s\" rejected because the " \ d221 1 a221 1 syslog(LOG_INFO, "%s: Attempt to unsubscribe \"%s\" from list \"%s\" deferred because the " \ @ 1.15 log @When a un-/subscribe command needs confirmation, the request for confirmation is sent to the address that is supposed to added to or removed from the list. If, and only if, this address is different than the one from which the request came, a short mail is sent to the requestor to inform him what is going on. @ text @d3 1 a3 1 $Revision: 1.14 $ d76 1 a76 1 syslog(LOG_NOTICE, "%s: unsubscribe-command invalid: No list specified.", MailStruct->From); d121 2 a122 2 syslog(LOG_INFO, "\"%s\" tried to unsubscribe \"%s\" from list \"%s\", but " \ "couldn't provide the correct password.", originator, address, listname); d137 1 a137 2 buffer = text_easy_sprintf( "The mailing list \"%s\" is a closed forum and only the maintainer may " \ d146 1 a146 2 syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); d160 1 a160 2 buffer = text_easy_sprintf( "\"%s\" tried to unsubscribe the address \"%s\" from the \"%s\" mailing list, " \ d182 3 d218 8 a225 2 char* command = text_easy_sprintf("unsubscribe %s %s", address, listname); char* cookie = queue_command(MailStruct, command); d290 2 @ 1.14 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.13 $ d221 2 d232 10 a241 4 buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be unsubscribed from " \ "the mailing list \"%s\". This will not happen unless you confirm the " \ "request by replying to this mail and citing the string", originator, address, listname); d254 5 a258 16 fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); fprintf(fh, "Unsubscribing the address will need confirmation. Such a\n"); fprintf(fh, "request has been sent to the address already, so don't move!\n"); CloseMailer(fh); } else d260 20 a279 2 syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); return -1; @ 1.13 log @When a request for confirmation is required, the originator of the command will receive a short mail, telling him that this is so, so that he knows what's going on. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/unsubscribe.c,v $ $Revision: 1.12 $ 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.12 log @Delayed the processing of the acknowledgment-requirement so that you don't have to ack commands that will fail anyways. @ text @d3 1 a3 1 $Revision: 1.11 $ a220 2 /* Notify the owner. */ d243 21 @ 1.11 log @Added code that will send the "request for confirmation" mail out when apropriate. @ text @d3 1 a3 1 $Revision: 1.10 $ d179 3 d183 32 a214 1 else if (ListConfig->subtype == SUBSCRIPTION_ACKED && !g_is_approved) a250 34 } /* Okay, remove the address from the list. */ if (isSubscribed(listname, address, &list, &p, FALSE) == FALSE) { /* Notify the originator, that the address is not subscribed at all. */ fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); fprintf(fh, "The address is not subscribed to this list.\n"); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); return -1; } } else { @ 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 $ d179 38 @ 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 $ d117 1 a117 1 if (ListConfig->allowpubsub == FALSE) @ 1.8 log @The requestor will now receive a mail telling him something went wrong when he tries to unsubscribe an address without specifying a list name. @ text @d3 1 a3 1 $Revision: 1.6 $ a165 66 text_wordwrap(buffer, 70); fprintf(fh, "%s\n\n", buffer); fprintf(fh, "password \n"); fprintf(fh, "unsubscribe %s %s\n", address, listname); CloseMailer(fh); } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); return -1; } return 0; } if (ListConfig->allowaliensub == FALSE && (MailStruct->From == NULL || !strcasecmp(address, MailStruct->From) == FALSE) && (MailStruct->Reply_To == NULL || !strcasecmp(address, MailStruct->Reply_To) == FALSE)) { /* Trying to unsubscribe something different than himself. */ syslog(LOG_INFO, "\"%s\" tried to unsubscribe \"%s\" from list \"%s\", but the " \ "list type doesn't allow this.", originator, address, listname); fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); buffer = text_easy_sprintf( "The mailing list \"%s\" does not allow to automatically subscribe or unsubscribe an " \ "address not equal to the one, you are mailing from. Your request has been forwarded " \ "to the list administrator, so please don't send any futher mail. You will be notified " \ "as soon as possible.", listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); CloseMailer(fh); } else syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); /* Notify the owner. */ fh = vOpenMailer(envelope, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", owner); fprintf(fh, "Subject: Petidomo: APPROVE %s@@%s: Unauthorized request from \"%s\"\n", listname, ListConfig->fqdn, originator); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); buffer = text_easy_sprintf( "\"%s\" tried to unsubscribe the address \"%s\" from the \"%s\" mailing list. " \ "The list type does not allow unsubscribing addresses not equal to the From: " \ "address, though, so the request has been denied. To unsubscribe this person " \ "manually, send the following commands to the server:", originator, address, listname); @ 1.7 log @Set the right margin for word-wrapping to 70 characters instead of 75. @ text @d29 2 a30 1 { d42 6 d50 2 a51 1 if (param1 != NULL) { d53 1 a53 1 listname = param1; d55 1 a55 1 address = param1; d57 7 a63 5 if (param2 != NULL) { if (isValidListName(param2) == TRUE) listname = param2; else if (isRFC822Address(param2) == TRUE) address = param2; a64 1 } d67 37 a103 9 address = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; if (listname == NULL && defaultlist != NULL) listname = defaultlist; if (address == NULL || listname == NULL) { syslog(LOG_NOTICE, "%s: unsubscribe-command invalid: No list specified.", MailStruct->From); return 0; } d105 1 a105 1 /* Initialize internal stuff. */ a109 1 originator = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; d113 2 a114 2 if (isValidAdminPassword(getPassword(), listname) == FALSE) { d117 2 a118 2 if (ListConfig->allowpubsub == FALSE) { d122 1 a122 1 "couldn't provide the correct password.", originator, address, listname); d125 2 a126 1 if (fh != NULL) { d133 1 a133 1 fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); d138 4 a141 4 "The mailing list \"%s\" is a closed forum and only the maintainer may " \ "unsubscribe addresses. Your request has been forwarded to the " \ "appropriate person, so please don't send any further mail. You will " \ "be notified as soon as possible.", listname); d145 1 a145 1 } d147 2 a148 2 syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); d153 2 a154 1 if (fh != NULL) { d163 3 a165 3 "\"%s\" tried to unsubscribe the address \"%s\" from the \"%s\" mailing list, " \ "but couldn't provide the correct password. To unsubscribe him, send the " \ "following commands to the server:", originator, address, listname); d171 3 a173 2 } else { d176 2 a178 2 return 0; } d181 2 a182 1 (MailStruct->Reply_To == NULL || !strcasecmp(address, MailStruct->Reply_To) == FALSE)) { d187 1 a187 1 "list type doesn't allow this.", originator, address, listname); d190 2 a191 1 if (fh != NULL) { d198 1 a198 1 fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); d203 4 a206 4 "The mailing list \"%s\" does not allow to automatically subscribe or unsubscribe an " \ "address not equal to the one, you are mailing from. Your request has been forwarded " \ "to the list administrator, so please don't send any futher mail. You will be notified " \ "as soon as possible.", listname); d210 1 a210 1 } d212 2 a213 2 syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); d218 2 a219 1 if (fh != NULL) { d228 4 a231 4 "\"%s\" tried to unsubscribe the address \"%s\" from the \"%s\" mailing list. " \ "The list type does not allow unsubscribing addresses not equal to the From: " \ "address, though, so the request has been denied. To unsubscribe this person " \ "manually, send the following commands to the server:", originator, address, listname); d237 3 a239 2 } else { d242 2 a244 1 return 0; a245 1 } d249 2 a250 2 if (isSubscribed(listname, address, &list, &p, FALSE) == FALSE) { d255 2 a256 1 if (fh != NULL) { d263 1 a263 1 fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); d269 3 a271 2 } else { d273 1 a273 1 originator); d276 3 a278 2 } else { d280 2 a281 1 if (fh == NULL) { d284 1 a284 1 } d295 1 a295 1 fh = vOpenMailer(envelope, address, owner, NULL); d297 3 a299 2 fh = vOpenMailer(envelope, address, originator, owner, NULL); if (fh != NULL) { d301 1 a301 1 listname, ListConfig->fqdn); d304 1 a304 1 fprintf(fh, "Cc: %s\n", owner); d306 1 a306 1 fprintf(fh, "Cc: %s, %s\n", originator, owner); d309 1 a309 1 fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); d313 2 a314 1 if (!strcasecmp(address, originator) == TRUE) { d316 5 a320 4 "Per your request, the address \"%s\" has been unsubscribed from the " \ "\"%s\" mailing list.\n\n", address, listname); } else { d322 3 a324 3 "Per request from \"%s\", the address \"%s\" has been unsubscribed from the " \ "\"%s\" mailing list.\n\n", originator, address, listname); } d328 3 a330 2 } else { d333 1 a334 1 } d337 1 a337 1 } @ 1.6 log @Rewrote Petidomo so that virtually any file's path can be configured at run-time now. @ text @d3 1 a3 1 $Revision: 1.5 $ d105 1 a105 1 text_wordwrap(buffer, 75); d128 1 a128 1 text_wordwrap(buffer, 75); d166 1 a166 1 text_wordwrap(buffer, 75); d190 1 a190 1 text_wordwrap(buffer, 75); d275 1 a275 1 text_wordwrap(buffer, 75); @ 1.5 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.4 $ d233 1 a233 2 buffer = text_easy_sprintf("lists/%s/list", listname); fh = fopen(buffer, "w"); d235 1 a235 1 syslog(LOG_ERR, "Failed to open file \"%s\" for writing: %m", buffer); @ 1.4 log @Removed the signature code and all code that depended on it. In the new Petidomo, the signature mechanism for server mails will work differently. @ text @d3 1 a3 1 $Revision: 1.3 $ d93 1 a93 1 fprintf(fh, "Subject: Your request \"unsubscribe %s %s\"\n", d120 1 a120 1 fprintf(fh, "Subject: Unauthorized request from \"%s\"\n", originator); d154 1 a154 1 fprintf(fh, "Subject: Your request \"unsubscribe %s %s\"\n", d181 1 a181 1 fprintf(fh, "Subject: Unauthorized request from \"%s\"\n", originator); d216 1 a216 1 fprintf(fh, "Subject: Your request \"unsubscribe %s %s\"\n", d260 1 a260 1 fprintf(fh, "Subject: Request \"unsubscribe %s %s\"\n", address, listname); @ 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 $ a106 1 AppendSignature(fh); a131 1 AppendSignature(fh); a167 1 AppendSignature(fh); a193 1 AppendSignature(fh); a223 1 AppendSignature(fh); a277 1 AppendSignature(fh); @ 1.2 log @ - Added correct GNU GPL copyright statements to the files. - Removed unnecessary include statements. @ text @d2 2 a3 2 $Source$ $Revision$ a40 3 debug((DEBUG_COMMAND, 3, "DeleteAddress(\"%s\", \"%s\") with default list \"%s\".", param1, param2, defaultlist)); a74 2 debug((DEBUG_COMMAND, 1, "Unsubscribing \"%s\" to list \"%s\".", address, listname)); a210 5 /* Address is not subscribed. */ debug((DEBUG_COMMAND, 2, "\"%s\" is not subscribed to list \"%s\".", address, listname)); @ 1.1 log @Initial revision @ text @d2 17 a18 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/unsubscribe.c,v $ * $Revision: 1.10 $ * $Date: 1997/12/09 21:18:47 $ * * Copyright (C) 1996 by CyberSolutions GmbH. * All rights reserved. */ d21 2 a22 2 #include #include @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@