head 1.10; access; symbols PETIDOMO_4_0b6:1.10 PETIDOMO_4_0b5:1.10 PETIDOMO_4_0b4:1.10 PETIDOMO_4_0b3:1.10 BEFORETHL:1.10 petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.10 date 2001.02.12.20.44.13; author simons; state Exp; branches; next 1.9; 1.9 date 2001.01.19.14.56.33; author rse; state Exp; branches; next 1.8; 1.8 date 2001.01.18.20.30.50; author rse; 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.24; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.24; author simons; state Exp; branches; next ; desc @@ 1.10 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 @/* $Source: /e/ossp/cvs/ossp-pkg/petidomo/members.c,v $ $Revision: 1.9 $ 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 #include #include "libtext/text.h" #include "petidomo.h" int SendSubscriberList(struct Mail * MailStruct, const char * param1, const char * param2, const char * defaultlist) { const struct List_Config * ListConfig; FILE * fh; const char * address = NULL; const char * listname = NULL; char owner[4096]; char envelope[4096]; char * buffer; char * p; int i; /* Try to find out, which parameter is what. */ if (param1 != NULL) { if (isValidListName(param1) == TRUE) listname = param1; } address = (MailStruct->Reply_To) ? MailStruct->Reply_To : MailStruct->From; if (listname == NULL && defaultlist != NULL) listname = defaultlist; if (address == NULL || listname == NULL) { syslog(LOG_INFO, "%s: members-command invalid: No list specified.", MailStruct->From); return 0; } /* Initialize internal stuff. */ ListConfig = getListConfig(listname); sprintf(owner, "%s-owner@@%s", listname, ListConfig->fqdn); sprintf(envelope, "%s-owner@@%s", listname, ListConfig->fqdn); /* Check whether 'members' is allowed for this list. */ if (isValidAdminPassword(getPassword(), listname) == FALSE && ListConfig->allowmembers == FALSE) { syslog(LOG_INFO, "MEMBERS command from \"%s\" has been denied.", address); fh = vOpenMailer(envelope, address, owner, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", address); fprintf(fh, "Cc: %s\n", owner); fprintf(fh, "Subject: Petidomo: Request \"members %s\"\n", 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 MEMBERS command has been disabled for this mailing list, I am " \ "afraid. If there's a certain reason, why you need to know the list " \ "of subscribed addresses, please contact the mailing list administrator " \ "under the address \"%s\" instead.", owner); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); CloseMailer(fh); } else syslog(LOG_ERR, "Failed to send mail to \"%s\"", address); return 0; } /* Okay, send the address list back. */ buffer = loadfile(ListConfig->address_file); if (buffer == NULL) { syslog(LOG_ERR, "Failed to open file \"%s\"", ListConfig->address_file); return -1; } fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { fprintf(fh, "From: %s-request@@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", address); fprintf(fh, "Subject: Petidomo: Request \"members %s\"\n", 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, "Subscribers of list \"%s\":\n", listname); fprintf(fh, "======================="); fflush(fh); for (i = 0; i < strlen(listname); i++) { fputc('=', fh); } fputc('\n', fh); for (p = buffer; *p; p++) { if (isspace((int)*p)) { fputc('\n', fh); while (*p != '\0' && *p != '\n') p++; } else { fputc(*p, fh); } } CloseMailer(fh); } else { free(buffer); syslog(LOG_ERR, "Failed to send email to \"%s\"!", address); return -1; } free(buffer); return 0; } @ 1.9 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.8 $ d57 1 a57 1 syslog(LOG_NOTICE, "%s: members-command invalid: No list specified.", d73 1 a73 1 syslog(LOG_NOTICE, "MEMBERS command from \"%s\" has been denied.", address); @ 1.8 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.7 $ d24 1 @ 1.7 log @Set the right margin for word-wrapping to 70 characters instead of 75. @ text @d2 2 a3 2 $Source: /d1/e/petidomo/cvs/petidomo/source/members.c,v $ $Revision: 1.6 $ 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.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 $ d90 1 a90 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 $ d102 4 a105 4 buffer = text_easy_sprintf("lists/%s/list", listname); buffer = loadfile(buffer); if (buffer == NULL) { syslog(LOG_ERR, "Failed to open file \"~petidomo/lists/%s/list\"", listname); d107 1 a107 1 } @ 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 $ d79 1 a79 1 fprintf(fh, "Subject: Request \"members %s\"\n", listname); d114 1 a114 1 fprintf(fh, "Subject: Request \"members %s\"\n", 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 $ a91 1 AppendSignature(fh); a136 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$ a43 3 debug((DEBUG_COMMAND, 3, "SendSubscriberList(\"%s\") with default list \"%s\".", param1, defaultlist)); a101 3 debug((DEBUG_COMMAND, 1, "Sending list of subscribed addresses for list " "\"%s\" to \"%s\".", listname, address)); @ 1.1 log @Initial revision @ text @d2 17 a18 7 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/members.c,v $ * $Revision: 1.8 $ * $Date: 1998/08/14 22:54:40 $ * * Copyright (C) 1997 by CyberSolutions GmbH. * All rights reserved. */ d25 2 a26 2 #include #include @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@