Index: ossp-pkg/petidomo/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/petidomo/Makefile.in,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/petidomo/Makefile.in,v' 2>/dev/null --- Makefile.in 2000/12/16 12:14:15 1.15 +++ Makefile.in 2000/12/16 13:11:54 1.16 @@ -17,7 +17,6 @@ includedir = @includedir@ CC = @CC@ -CXX = @CXX@ AR = ar RANLIB = @RANLIB@ LEX = @LEX@ @@ -25,7 +24,6 @@ INSTALL = ../etc/install-sh CFLAGS = @CFLAGS@ -CXXFLAGS = @CXXFLAGS@ CPPFLAGS = @CPPFLAGS@ @DEFS@ LDFLAGS = @LDFLAGS@ @@ -33,24 +31,21 @@ filter.o handleacl.o help.o hermes.o index.o io.o listserv.o \ mailer.o members.o parsearray.o password.o rfcparse.o \ subscribe.o tool.o unsubscribe.o main.o -LIBS = librfc822/librfc822.a liblists/liblists.a libargv/libargv.a \ +LIBS = librfc822/librfc822.a libmpools/libmpools.a liblists/liblists.a libargv/libargv.a \ libconfigfile/libconfigfile.a libtext/libtext.a -FLAGS_TO_PASS = CC="$(CC)" CXX="$(CXX)" AR="$(AR)" RANLIB="$(RANLIB)" LEX="$(LEX)" \ - YACC="$(YACC)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ +FLAGS_TO_PASS = CC="$(CC)" AR="$(AR)" RANLIB="$(RANLIB)" LEX="$(LEX)" \ + YACC="$(YACC)" CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" .SUFFIXES: -.SUFFIXES: .c .o .cpp +.SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -.cpp.o: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< - petidomo: $(OBJS) $(LIBS) - $(CXX) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) + $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) acl.c acl_scan.h: acl.y $(YACC) -d -p acl acl.y @@ -95,24 +90,3 @@ # Dependencies -acl.o: libtext/text.h petidomo.h acl_scan.c acl_scan.h -acl_scan.o: acl_scan.h -archive.o: libtext/text.h petidomo.h -authen.o: libtext/text.h petidomo.h -config.o: liblists/lists.h libconfigfile/configfile.h petidomo.h -filter.o: petidomo.h -handleacl.o: petidomo.h -help.o: libtext/text.h petidomo.h -hermes.o: libtext/text.h petidomo.h -index.o: libtext/text.h petidomo.h -io.o: petidomo.h -listserv.o: libtext/text.h petidomo.h -mailer.o: libtext/text.h petidomo.h -main.o: petidomo.h libargv/argv.h -members.o: libtext/text.h petidomo.h -parsearray.o: petidomo.h -password.o: petidomo.h -rfcparse.o: librfc822/rfc822.hpp libtext/text.h petidomo.h -subscribe.o: libtext/text.h petidomo.h -tool.o: libtext/text.h petidomo.h -unsubscribe.o: libtext/text.h petidomo.h Index: ossp-pkg/petidomo/main.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/main.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/petidomo/main.c,v' 2>/dev/null --- main.c 2000/12/13 15:35:14 1.2 +++ main.c 2000/12/16 13:11:54 1.3 @@ -23,59 +23,32 @@ #include #include +#include "libargv/argv.h" #include "petidomo.h" #ifndef LOG_PERROR # define LOG_PERROR 0 #endif -MODULE_TABLE /* defined in debug.h */ -static char * listname = NULL; -#ifdef DEBUG -static argv_array_t debug; -#endif +static char* listname = NULL; +static char* mode = NULL; int main(int argc, char * argv[]) { const struct PD_Config * MasterConfig; char * incoming_mail; - char * programname; - argv_t args[] = { -#ifdef DEBUG - {'d', "debug", ARGV_CHAR_P | ARGV_FLAG_ARRAY , &debug, "debug", - "Set debug level per module."}, -#endif + argv_t args[] = + { + {ARGV_MAND, "mode", ARGV_CHAR_P, &mode, "mode", "listserv, deliver, or approve."}, {ARGV_MAYBE, 0L, ARGV_CHAR_P, &listname, "listname", "Default mailing list."}, {ARGV_LAST} - }; - int fd; - - /* Determine the name we have been called under. */ - - programname = strrchr(argv[0], (int) '/'); - if (programname == NULL) - programname = argv[0]; - else - programname++; + }; /* Init logging routines first of all, so that we can report errors. */ - openlog(programname, LOG_CONS | LOG_PID | LOG_PERROR, LOG_MAIL); - - /* Set our umask. */ - - umask(S_IRWXO); /* We don't care for "others". */ - - /* Switch real and effective uid/gid to 'petidomo'. */ - -#ifdef HAVE_SETREUID - setreuid(geteuid(), geteuid()); -#endif -#ifdef HAVE_SETREGID - setregid(getegid(), getegid()); -#endif + openlog("petidomo", LOG_CONS | LOG_PID | LOG_PERROR, LOG_MAIL); /* Parse the command line. */ @@ -83,13 +56,6 @@ argv_version_string = "OpenPetidomo"; argv_process(args, argc, argv); - /* Set debug level according to the wishes of the user. */ - -#ifdef DEBUG - if (argvSetDebugLevel(debug) != 0) - exit(1); -#endif - /* Init Petidomo's internal stuff. */ if (InitPetidomo() != 0) { @@ -106,58 +72,32 @@ syslog(LOG_ERR, "Failed to read incoming mail from standard input."); exit(1); } - RescueMail(incoming_mail); - - /* Detach ourselves, if the configurator wished it so. */ - - if (MasterConfig->detach == TRUE) { - debug((DEBUG_MAIN, 3, "Detaching from control terminal and running asyncronously.")); - switch (fork()) { - case -1: - syslog(LOG_CRIT, "Can't fork(): %m"); - exit(1); - case 0: - setsid(); - fd = open("/dev/null", O_RDWR, 0); - if (fd != -1) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - if (fd > 2) - close (fd); - } - break; - default: - _exit(0); - } - } /* Now decide what we actually do with the mail. */ - if (strcasecmp("listserv", programname) == 0) + if (strcasecmp("listserv", mode) == 0) listserv_main(incoming_mail, listname); - else if (strcasecmp("hermes", programname) == 0) + else if (strcasecmp("deliver", mode) == 0) { if (listname != NULL) hermes_main(incoming_mail, listname); else { - syslog(LOG_ERR, "Wrong command line syntax. \"hermes\" requires a parameter."); + syslog(LOG_ERR, "Wrong command line syntax; deliver mode requires a parameter."); exit(1); } } - else if (strcasecmp("petidomo", programname) == 0) + else if (strcasecmp("petidomo", mode) == 0) { /* do nothing */ } else { - syslog(LOG_ERR, "I have been called under an unknown name \"%s\".", programname); + syslog(LOG_ERR, "I don't know anything about mode \"%s\".", mode); exit(1); } /* Exit gracefully. */ - RemoveRescueMail(); return 0; } Index: ossp-pkg/petidomo/petidomo.h RCS File: /v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/petidomo/petidomo.h,v' 2>/dev/null --- petidomo.h 2000/12/13 15:54:29 1.1 +++ petidomo.h 2000/12/16 13:11:54 1.2 @@ -48,9 +48,6 @@ # include #endif -#include "libargv/argv.h" -#include "debug.h" - /********** config.c **********/ struct PD_Config { @@ -59,8 +56,6 @@ char * master_password; char * mta; char * mta_options; - int detach; - int show_stats; }; enum { @@ -127,11 +122,6 @@ int isValidAdminPassword(const char *password, const char *listname); int isValidPostingPassword(const char *password, const char *listname); -/********** exit.c **********/ - -void RescueMail(const char *mail); -void RemoveRescueMail(void); - /********** filter.c **********/ int MailFilter(struct Mail *MailStruct, const char *filter); @@ -196,18 +186,10 @@ int isValidListName(const char *); bool isSubscribed(const char *, const char *, char **, char **, bool); -/********** signature.c **********/ - -void AppendSignature(FILE * fh); - /********** unsubscribe.c **********/ int DeleteAddress(struct Mail *MailStruct, const char *param1, const char *param2, const char *defaultlist); -/********** argvSetDebugLevel.c **********/ - -int argvSetDebugLevel(argv_array_t debug); - /********** hermes.c **********/ int hermes_main(char *incoming_mail, const char *listname); @@ -220,8 +202,7 @@ struct Parse { const char * keyword; - int (*handleCommand)(struct Mail *, const char *, const char *, const - char *); + int (*handleCommand)(struct Mail *, const char *, const char *, const char *); }; extern struct Parse ParseArray[];