- Added correct GNU GPL copyright statements to the files.

- Removed unnecessary include statements.
This commit is contained in:
Peter Simons 2000-12-13 15:35:14 +00:00
parent bda7a0d438
commit 5ad045c241
24 changed files with 584 additions and 324 deletions

28
acl.y
View File

@ -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 <sys/wait.h>
#include <errno.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
static int yyerror(char *);
static int yylex(void);

View File

@ -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 <ctype.h>

View File

@ -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 <stdlib.h>
#include <string.h>
@ -14,8 +24,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
ArchiveMail(const struct Mail * MailStruct, const char * listname)

View File

@ -1,19 +1,27 @@
/*
* $Source$
* $Revision$
* $Date$
*
* Copyright (C) 1996,97 CyberSolutions GmbH.
* All rights reserved.
*
* - Set debug-level for various modules from the command line.
*/
$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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <debug.h>
#include <argv.h>
#include "debug.h"
#include "libargv/argv.h"
#ifdef DEBUG
@ -43,6 +51,10 @@ extern const char * const ModuleTable[];
REQUIRES: extern const char * const ModuleTable[]
*/
/* let's define ModuleTable here */
MODULE_TABLE
int
argvSetDebugLevel(argv_array_t debug /* parameter array as returned by the argv routines */
)
@ -51,7 +63,7 @@ argvSetDebugLevel(argv_array_t debug /* parameter array as returned by the argv
char * DebugLevel;
unsigned int count, i;
for (count = 0; count < debug.aa_entryn; count++) {
for (count = 0; count < debug.aa_entry_n; count++) {
ModuleName = strtok(ARGV_ARRAY_ENTRY(debug, char *, count), ",/:");
DebugLevel = strtok(NULL, ",/:");
if (ModuleName == NULL || DebugLevel == NULL

View File

@ -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 <string.h>
#include <ctype.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
FindBodyPassword(struct Mail * MailStruct)

View File

@ -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 <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pwd.h>
#include <lists.h>
#include <configfile.h>
#include <petidomo.h>
#include "liblists/lists.h"
#include "libconfigfile/configfile.h"
#include "petidomo.h"
static struct PD_Config * MasterConfig;
List ListConfigs;
@ -25,7 +35,7 @@ List ListConfigs;
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;

28
exit.c
View File

@ -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 <stdio.h>
#include <stdlib.h>
@ -13,8 +23,8 @@
#include <fcntl.h>
#include <errno.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
static char * s_crash_filename = NULL;

View File

@ -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 <stdlib.h>
#include <sys/wait.h>
@ -14,7 +24,7 @@
#include <fcntl.h>
#include <errno.h>
#include <petidomo.h>
#include "petidomo.h"
#define READ 0
#define WRITE 1

View File

@ -1,15 +1,24 @@
/*
* $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 <stdlib.h>
#include <petidomo.h>
#include "petidomo.h"
/* Returncodes have the following meaning: '-1' == Error, '0' ==
Proceed, '1' == Mail has been taken care of. */

28
help.c
View File

@ -1,14 +1,24 @@
/*
* $Source$
* $Revision$
* $Date$
*
* Copyright (C) 1996 by CyberSolutions GmbH.
* All rights reserved.
*/
$Source$
$Revision$
#include <text.h>
#include <petidomo.h>
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,

View File

@ -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 <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
hermes_main(char * incoming_mail, const char * listname)
@ -51,6 +61,10 @@ hermes_main(char * incoming_mail, const char * listname)
/* 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;

28
index.c
View File

@ -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 <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
GenIndex(struct Mail * MailStruct,

26
io.c
View File

@ -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 <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <petidomo.h>
#include "petidomo.h"
char *
LoadFromDescriptor(int fd)

View File

@ -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 <string.h>
#include <ctype.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
char * g_currLine; /* pointer to the line currently parsed */
@ -45,6 +55,10 @@ listserv_main(char * incoming_mail, char * default_list)
/* 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;

170
mailer.c
View File

@ -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 <stdlib.h>
#include <stdarg.h>
@ -14,8 +24,8 @@
#include <unistd.h>
#include <ctype.h>
#include <text.h>
#include <petidomo.h>
#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 @@ vOpenMailer(const char * envelope, ...)
/* 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 @@ vOpenMailer(const char * envelope, ...)
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 @@ ListMail(const char * envelope, const char * listname, const struct Mail * MailS
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 @@ ListMail(const char * envelope, const char * listname, const struct Mail * MailS
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;
}
}

63
main.c
View File

@ -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 <stdio.h>
#include <sys/stat.h>
@ -13,9 +23,7 @@
#include <fcntl.h>
#include <string.h>
#include <argv.h>
#include <petidomo.h>
#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 @@ main(int argc, char * argv[])
/* 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 @@ main(int argc, char * argv[])
/* 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;
}
}

View File

@ -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 <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
SendSubscriberList(struct Mail * MailStruct,

View File

@ -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"

View File

@ -1,15 +1,24 @@
/*
* $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 <ctype.h>
#include <petidomo.h>
#include "petidomo.h"
static const char * s_password = NULL;
extern char * g_currLine;

View File

@ -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 <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <rfc822.h>
#include <text.h>
#include <petidomo.h>
#include "librfc822/rfc822.h"
#include "libtext/text.h"
#include "petidomo.h"
void
RemoveCarrigeReturns(char * buffer)
@ -343,6 +353,24 @@ ParseMail(struct Mail **result, char * incoming_mail, const char * fqdn)
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;

View File

@ -1,40 +1,21 @@
/*
* $Source$
* $Revision$
* $Date$
*
* Copyright (c) 1996-99 by CyberSolutions GmbH, Germany.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by CyberSolutions GmbH.
*
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$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 <stdio.h>
#include <unistd.h>

View File

@ -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 <string.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
AddAddress(struct Mail * MailStruct,
@ -18,6 +28,7 @@ AddAddress(struct Mail * MailStruct,
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 @@ AddAddress(struct Mail * MailStruct,
}
/* 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 @@ AddAddress(struct Mail * MailStruct,
}
return 0;
}

30
tool.c
View File

@ -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 <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
bool
isSubscribed(const char * listname, const char * address,
@ -57,7 +67,7 @@ isSubscribed(const char * listname, const char * address,
}
}
#if DEBUG
#ifdef DEBUG
if (*p != '\0') {
debug((DEBUG_COMMAND, 3, "Found address: \"%s\".", p));
}

View File

@ -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 <string.h>
#include <text.h>
#include <petidomo.h>
#include "libtext/text.h"
#include "petidomo.h"
int
DeleteAddress(struct Mail * MailStruct,