Index: ossp-pkg/petidomo/acl.y RCS File: /v/ossp/cvs/ossp-pkg/petidomo/acl.y,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/acl.y,v' 2>/dev/null --- acl.y 2000/12/13 13:19:22 1.1 +++ acl.y 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1997 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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. +*/ %{ /* Definitions we need in the parser. */ @@ -16,8 +26,8 @@ #include #include -#include -#include +#include "libtext/text.h" +#include "petidomo.h" static int yyerror(char *); static int yylex(void); Index: ossp-pkg/petidomo/acl_scan.l RCS File: /v/ossp/cvs/ossp-pkg/petidomo/Attic/acl_scan.l,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/Attic/acl_scan.l,v' 2>/dev/null --- acl_scan.l 2000/12/13 13:19:22 1.1 +++ acl_scan.l 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1997 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 Index: ossp-pkg/petidomo/archive.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/archive.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/archive.c,v' 2>/dev/null --- archive.c 2000/12/13 13:19:22 1.1 +++ archive.c 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 @@ -14,8 +24,8 @@ #include #include -#include -#include +#include "libtext/text.h" +#include "petidomo.h" int ArchiveMail(const struct Mail * MailStruct, const char * listname) Index: ossp-pkg/petidomo/authen.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/authen.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/authen.c,v' 2>/dev/null --- authen.c 2000/12/13 13:19:22 1.1 +++ authen.c 2000/12/13 15:35:14 1.2 @@ -1,17 +1,27 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 "libtext/text.h" +#include "petidomo.h" int FindBodyPassword(struct Mail * MailStruct) Index: ossp-pkg/petidomo/config.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/Attic/config.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/Attic/config.c,v' 2>/dev/null --- config.c 2000/12/13 13:19:22 1.1 +++ config.c 2000/12/13 15:35:14 1.2 @@ -1,20 +1,30 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 -#include +#include "liblists/lists.h" +#include "libconfigfile/configfile.h" +#include "petidomo.h" static struct PD_Config * MasterConfig; List ListConfigs; @@ -25,7 +35,7 @@ static char * fqdn = NULL; static char * master_password = NULL; static char * mta = "/usr/sbin/sendmail"; -static char * mta_options = "-f%s"; +static char * mta_options = "-i -f%s"; static bool detach = FALSE; static bool show_stats = TRUE; Index: ossp-pkg/petidomo/filter.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/filter.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/filter.c,v' 2>/dev/null --- filter.c 2000/12/13 13:19:23 1.1 +++ filter.c 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 @@ -14,7 +24,7 @@ #include #include -#include +#include "petidomo.h" #define READ 0 #define WRITE 1 Index: ossp-pkg/petidomo/handleacl.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/handleacl.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/handleacl.c,v' 2>/dev/null --- handleacl.c 2000/12/13 13:19:23 1.1 +++ handleacl.c 2000/12/13 15:35:14 1.2 @@ -1,15 +1,24 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ -#include + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. -#include + OpenPetidomo 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 "petidomo.h" /* Returncodes have the following meaning: '-1' == Error, '0' == Proceed, '1' == Mail has been taken care of. */ Index: ossp-pkg/petidomo/help.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/help.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/help.c,v' 2>/dev/null --- help.c 2000/12/13 13:19:23 1.1 +++ help.c 2000/12/13 15:35:14 1.2 @@ -1,14 +1,24 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ -#include -#include + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 "libtext/text.h" +#include "petidomo.h" int SendHelp(struct Mail * MailStruct, Index: ossp-pkg/petidomo/hermes.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/hermes.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/hermes.c,v' 2>/dev/null --- hermes.c 2000/12/13 13:19:23 1.1 +++ hermes.c 2000/12/13 15:35:14 1.2 @@ -1,18 +1,28 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 +#include "libtext/text.h" +#include "petidomo.h" int hermes_main(char * incoming_mail, const char * listname) @@ -51,6 +61,10 @@ /* Do sanity checks. */ + if (MailStruct->Envelope == NULL) { + syslog(LOG_NOTICE, "Received mail without a valid envelope."); + return 0; + } if (MailStruct->From == NULL) { syslog(LOG_NOTICE, "Received mail without From: line."); return 0; Index: ossp-pkg/petidomo/index.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/index.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/index.c,v' 2>/dev/null --- index.c 2000/12/13 13:19:23 1.1 +++ index.c 2000/12/13 15:35:14 1.2 @@ -1,19 +1,29 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 +#include "libtext/text.h" +#include "petidomo.h" int GenIndex(struct Mail * MailStruct, Index: ossp-pkg/petidomo/io.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/io.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/io.c,v' 2>/dev/null --- io.c 2000/12/13 13:19:23 1.1 +++ io.c 2000/12/13 15:35:14 1.2 @@ -1,17 +1,27 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1997 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 "petidomo.h" char * LoadFromDescriptor(int fd) Index: ossp-pkg/petidomo/listserv.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/listserv.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/listserv.c,v' 2>/dev/null --- listserv.c 2000/12/13 13:19:23 1.1 +++ listserv.c 2000/12/13 15:35:14 1.2 @@ -1,17 +1,27 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 "libtext/text.h" +#include "petidomo.h" char * g_currLine; /* pointer to the line currently parsed */ @@ -45,6 +55,10 @@ /* Do sanity checks. */ + if (MailStruct->Envelope == NULL) { + syslog(LOG_NOTICE, "Received mail without a valid envelope."); + return 0; + } if (MailStruct->From == NULL) { syslog(LOG_NOTICE, "Received mail without From: line."); return 0; Index: ossp-pkg/petidomo/mailer.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/mailer.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/mailer.c,v' 2>/dev/null --- mailer.c 2000/12/13 13:19:24 1.1 +++ mailer.c 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 @@ -14,8 +24,8 @@ #include #include -#include -#include +#include "libtext/text.h" +#include "petidomo.h" #ifndef ARG_NUM_MAX # define ARG_NUM_MAX 4096 @@ -26,22 +36,22 @@ static char * my_strcpy(char * dst, const char * src) -{ + { while((*dst++ = *src++) != '\0') - ; + ; return dst-1; -} + } FILE * OpenMailer(const char * envelope, const char * recipients[]) -{ + { assert(1==0); return NULL; -} + } FILE * vOpenMailer(const char * envelope, ...) -{ + { const struct PD_Config * MasterConfig; va_list ap; FILE * fh; @@ -79,28 +89,32 @@ /* Copy the mta's options into the array, while replacing '%s' with the envelope. */ - for (options = MasterConfig->mta_options; *options != '\0'; ) { + for (options = MasterConfig->mta_options; *options != '\0'; ) + { debug((DEBUG_MAILER, 4, "Parsing '%c' character.", *options)); - if (options[0] == '%' && options[1] == 's') { + if (options[0] == '%' && options[1] == 's') + { p = my_strcpy(p, envelope); *p++ = ' '; options += 2; break; - } - else { + } + else + { debug((DEBUG_MAILER, 4, "Wrote '%c' to aray.", *options)); *p++ = *options++; + } } - } *p++ = ' '; /* Append the list of recipients. */ va_start(ap, envelope); - while ((q = va_arg(ap, const char *)) != NULL) { + while ((q = va_arg(ap, const char *)) != NULL) + { p = my_strcpy(p, q); *p++ = ' '; - } + } p[-1] = '\0'; va_end(ap); @@ -108,35 +122,34 @@ fh = popen(cmdline, "w"); if (fh == NULL) - syslog(LOG_ERR, "Failed opening pipe to \"%s\": %m", cmdline); + syslog(LOG_ERR, "Failed opening pipe to \"%s\": %m", cmdline); free(cmdline); return fh; -} + } int CloseMailer(FILE * fh) -{ + { return pclose(fh); -} - + } static int my_strlen(const char * p) -{ + { u_int i; for (i = 0; *p && !isspace((int)*p); p++) - i++; + i++; return i; -} + } #define MYPIPE_READ fildes[0] #define MYPIPE_WRITE fildes[1] int ListMail(const char * envelope, const char * listname, const struct Mail * MailStruct) -{ + { const struct PD_Config * MasterConfig = getMasterConfig(); char ** arguments; u_int arguments_num = 256; @@ -164,11 +177,12 @@ sprintf(buffer, "lists/%s/list", listname); listfile = loadfile(buffer); if (listfile == NULL) - return 1; + return 1; /* Now go into delivery loop until we're finished. */ - for(counter = 0, currAddress = listfile; *currAddress != '\0'; counter = 0) { + for(counter = 0, currAddress = listfile; *currAddress != '\0'; counter = 0) + { /* Set up the call to the MTA, including options. */ @@ -176,86 +190,96 @@ debug((DEBUG_MAILER, 5, "MTA is \"%s\".", arguments[0])); sprintf(buffer, MasterConfig->mta_options, envelope); debug((DEBUG_MAILER, 5, "MTA options are \"%s\".", buffer)); - for (p = buffer, arguments[counter++] = buffer; *p != '\0'; p++) { + for (p = buffer, arguments[counter++] = buffer; *p != '\0'; p++) + { debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p)); - if (isspace((int)*p)) { + if (isspace((int)*p)) + { *p++ = '\0'; debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p)); while(*p != '\0' && isspace((int)*p)) - p++; + p++; debug((DEBUG_MAILER, 9, "Left to parse: \"%s\".", p)); arguments[counter++] = p; + } } - } if (strlen(arguments[counter-1]) == 0) - counter--; + counter--; /* Append as many recipients as fit. */ - for (address_byte = 0; *currAddress != '\0' ; currAddress = nextAddress) { + for (address_byte = 0; *currAddress != '\0' ; currAddress = nextAddress) + { nextAddress = text_find_next_line(currAddress); len = my_strlen(currAddress); - if (address_byte + len > max_address_byte) { + if (address_byte + len > max_address_byte) + { debug((DEBUG_MAILER, 1, "Sending early, command line exceeds %d characters.", ARG_MAX)); break; - } - if (counter > ARG_NUM_MAX) { + } + if (counter > ARG_NUM_MAX) + { debug((DEBUG_MAILER, 1, "Sending early, command line exceeds %d arguments.", ARG_NUM_MAX)); break; - } + } currAddress[len] = '\0'; debug((DEBUG_MAILER, 8, "Address \"%s\" is %u byte long.", currAddress, len)); address_byte += len; arguments[counter++] = currAddress; - if (counter+8 >= arguments_num) { + if (counter+8 >= arguments_num) + { debug((DEBUG_MAILER, 1, "Enlarging internal array.")); arguments_num += 256; arguments = realloc(arguments, (arguments_num+1) * sizeof(char *)); if (arguments == NULL) - return -1; + return -1; + } } - } /* Deliver the mail. */ arguments[counter++] = NULL; - if (pipe(fildes) == -1) { + if (pipe(fildes) == -1) + { syslog(LOG_ERR, "Couldn't open a pipe to my child process: %m"); return -1; - } + } child_pid = fork(); - switch(child_pid) { - case 0: - /* Child */ - close(MYPIPE_WRITE); - if (dup2(MYPIPE_READ, STDIN_FILENO) == -1) { - syslog(LOG_ERR, "Child process couldn't read from pipe: %m"); - return -1; - } - close(MYPIPE_READ); - execv(MasterConfig->mta, arguments); - syslog(LOG_ERR, "Couldn't exec(\"%s\"): %m", MasterConfig->mta); - return -1; - case -1: - /* Error */ - syslog(LOG_ERR, "Couldn't fork: %m"); - return -1; - default: - /* everything is fine */ - close(MYPIPE_READ); - } + switch(child_pid) + { + case 0: + /* Child */ + close(MYPIPE_WRITE); + if (dup2(MYPIPE_READ, STDIN_FILENO) == -1) + { + syslog(LOG_ERR, "Child process couldn't read from pipe: %m"); + return -1; + } + close(MYPIPE_READ); + execv(MasterConfig->mta, arguments); + syslog(LOG_ERR, "Couldn't exec(\"%s\"): %m", MasterConfig->mta); + return -1; + case -1: + /* Error */ + syslog(LOG_ERR, "Couldn't fork: %m"); + return -1; + default: + /* everything is fine */ + close(MYPIPE_READ); + } write(MYPIPE_WRITE, MailStruct->Header, strlen(MailStruct->Header)); write(MYPIPE_WRITE, "\n", 1); write(MYPIPE_WRITE, MailStruct->Body, strlen(MailStruct->Body)); if (MailStruct->ListSignature != NULL) - write(MYPIPE_WRITE, MailStruct->ListSignature, strlen(MailStruct->ListSignature)); + write(MYPIPE_WRITE, MailStruct->ListSignature, strlen(MailStruct->ListSignature)); close(MYPIPE_WRITE); waitpid(child_pid, &child_status, 0); - if (!(WIFEXITED(child_status) && WEXITSTATUS(child_status) == 0)) { + if (!(WIFEXITED(child_status) && WEXITSTATUS(child_status) == 0)) + { syslog(LOG_ERR, "The executed mail agent return error %d, aborting.", - WEXITSTATUS(child_status)); + WEXITSTATUS(child_status)); return -1; + } } - } return 0; -} + } Index: ossp-pkg/petidomo/main.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/main.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/main.c,v' 2>/dev/null --- main.c 2000/12/13 13:19:24 1.1 +++ main.c 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 @@ -13,9 +23,7 @@ #include #include -#include -#include -#include "version.h" +#include "petidomo.h" #ifndef LOG_PERROR # define LOG_PERROR 0 @@ -23,20 +31,22 @@ MODULE_TABLE /* defined in debug.h */ static char * listname = NULL; +#ifdef DEBUG static argv_array_t debug; +#endif int main(int argc, char * argv[]) -{ + { const struct PD_Config * MasterConfig; char * incoming_mail; char * programname; argv_t args[] = { #ifdef DEBUG - {'d', "debug", ARGV_CHARP | ARGV_ARRAY , &debug, "debug", + {'d', "debug", ARGV_CHAR_P | ARGV_FLAG_ARRAY , &debug, "debug", "Set debug level per module."}, #endif - {ARGV_MAYBE, 0L, ARGV_CHARP, &listname, "listname", "Default mailing list."}, + {ARGV_MAYBE, 0L, ARGV_CHAR_P, &listname, "listname", "Default mailing list."}, {ARGV_LAST} }; int fd; @@ -69,8 +79,8 @@ /* Parse the command line. */ - argv_help_string = "Petidomo Mailing List Server"; - argv_version_string = VERS; + argv_help_string = "OpenPetidomo Mailing List Server"; + argv_version_string = "OpenPetidomo"; argv_process(args, argc, argv); /* Set debug level according to the wishes of the user. */ @@ -125,22 +135,29 @@ /* Now decide what we actually do with the mail. */ if (strcasecmp("listserv", programname) == 0) - listserv_main(incoming_mail, listname); - else if (strcasecmp("hermes", programname) == 0) { + listserv_main(incoming_mail, listname); + else if (strcasecmp("hermes", programname) == 0) + { if (listname != NULL) - hermes_main(incoming_mail, listname); - else { + hermes_main(incoming_mail, listname); + else + { syslog(LOG_ERR, "Wrong command line syntax. \"hermes\" requires a parameter."); exit(1); + } } - } - else { + else if (strcasecmp("petidomo", programname) == 0) + { + /* do nothing */ + } + else + { syslog(LOG_ERR, "I have been called under an unknown name \"%s\".", programname); exit(1); - } + } /* Exit gracefully. */ RemoveRescueMail(); return 0; -} + } Index: ossp-pkg/petidomo/members.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/members.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/members.c,v' 2>/dev/null --- members.c 2000/12/13 13:19:24 1.1 +++ members.c 2000/12/13 15:35:14 1.2 @@ -1,19 +1,29 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1997 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 +#include "libtext/text.h" +#include "petidomo.h" int SendSubscriberList(struct Mail * MailStruct, Index: ossp-pkg/petidomo/parsearray.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/parsearray.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/parsearray.c,v' 2>/dev/null --- parsearray.c 2000/12/13 13:19:24 1.1 +++ parsearray.c 2000/12/13 15:35:14 1.2 @@ -1,11 +1,21 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 "petidomo.h" Index: ossp-pkg/petidomo/password.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/password.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/password.c,v' 2>/dev/null --- password.c 2000/12/13 13:19:24 1.1 +++ password.c 2000/12/13 15:35:14 1.2 @@ -1,15 +1,24 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ -#include + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. -#include + OpenPetidomo 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 "petidomo.h" static const char * s_password = NULL; extern char * g_currLine; Index: ossp-pkg/petidomo/rfcparse.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/rfcparse.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/rfcparse.c,v' 2>/dev/null --- rfcparse.c 2000/12/13 13:19:24 1.1 +++ rfcparse.c 2000/12/13 15:35:14 1.2 @@ -1,19 +1,29 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 +#include "librfc822/rfc822.h" +#include "libtext/text.h" +#include "petidomo.h" void RemoveCarrigeReturns(char * buffer) @@ -343,6 +353,24 @@ MailStruct->Subject += 1; debug((DEBUG_RFCPARSE, 5, "Subject: is \"%s\".", MailStruct->Subject)); } + else if (strncasecmp("Sender:", currLine, strlen("Sender:")) == 0) { + if (MailStruct->Envelope != NULL) + syslog(LOG_NOTICE, "Received mail with multiple sender addresses."); + MailStruct->Envelope = &currLine[strlen("Sender:")]; + if (*MailStruct->Envelope == ' ') + MailStruct->Envelope += 1; + debug((DEBUG_RFCPARSE, 5, "Sender: is \"%s\".", MailStruct->Envelope)); + } + else if (strncasecmp("Return-Path:", currLine, strlen("Return-Path:")) == 0 && + MailStruct->Envelope == NULL) + { + if (MailStruct->Envelope != NULL) + syslog(LOG_NOTICE, "Received mail with multiple sender addresses."); + MailStruct->Envelope = &currLine[strlen("Return-Path:")]; + if (*MailStruct->Envelope == ' ') + MailStruct->Envelope += 1; + debug((DEBUG_RFCPARSE, 5, "Return-Path: is \"%s\".", MailStruct->Envelope)); + } } *result = MailStruct; Index: ossp-pkg/petidomo/subscribe.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/subscribe.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/subscribe.c,v' 2>/dev/null --- subscribe.c 2000/12/13 13:19:25 1.1 +++ subscribe.c 2000/12/13 15:35:14 1.2 @@ -1,15 +1,25 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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" int AddAddress(struct Mail * MailStruct, @@ -18,6 +28,7 @@ const char * defaultlist) { const struct List_Config * ListConfig; + const struct PD_Config * MasterConfig; FILE * fh; const char * address = NULL; const char * listname = NULL; @@ -58,7 +69,7 @@ } /* Initialize internal stuff. */ - + MasterConfig = getMasterConfig(); ListConfig = getListConfig(listname); sprintf(owner, "%s-owner@%s", listname, ListConfig->fqdn); sprintf(envelope, "%s-owner@%s", listname, ListConfig->fqdn); @@ -322,3 +333,4 @@ } return 0; } + Index: ossp-pkg/petidomo/tool.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/tool.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/tool.c,v' 2>/dev/null --- tool.c 2000/12/13 13:19:25 1.1 +++ tool.c 2000/12/13 15:35:14 1.2 @@ -1,19 +1,29 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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 +#include "libtext/text.h" +#include "petidomo.h" bool isSubscribed(const char * listname, const char * address, @@ -57,7 +67,7 @@ } } -#if DEBUG +#ifdef DEBUG if (*p != '\0') { debug((DEBUG_COMMAND, 3, "Found address: \"%s\".", p)); } Index: ossp-pkg/petidomo/unsubscribe.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,v' 2>/dev/null --- unsubscribe.c 2000/12/13 13:19:25 1.1 +++ unsubscribe.c 2000/12/13 15:35:14 1.2 @@ -1,15 +1,25 @@ /* - * $Source$ - * $Revision$ - * $Date$ - * - * Copyright (C) 1996 by CyberSolutions GmbH. - * All rights reserved. - */ + $Source$ + $Revision$ + + Copyright (C) 2000 by CyberSolutions GmbH, Germany. + + This file is part of OpenPetidomo. + + OpenPetidomo 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. + + OpenPetidomo 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" int DeleteAddress(struct Mail * MailStruct,