Mercurial > hg > mlmmj
changeset 539:fd132b4e283a
CVS now compiles, 2nd iteration of submod
author | mmj |
---|---|
date | Fri, 10 Feb 2006 17:09:29 +1100 |
parents | c3d11ce2455e |
children | 2f374935d20c |
files | aclocal.m4 depcomp include/mlmmj-sub.h install-sh missing mkinstalldirs src/Makefile.am src/Makefile.in src/mlmmj-sub.c |
diffstat | 9 files changed, 82 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/aclocal.m4 Thu Feb 09 18:06:12 2006 +1100 +++ b/aclocal.m4 Fri Feb 10 17:09:29 2006 +1100 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. @@ -28,7 +28,7 @@ # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) + [AM_AUTOMAKE_VERSION([1.9.5])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*-
--- a/depcomp Thu Feb 09 18:06:12 2006 +1100 +++ b/depcomp Fri Feb 10 17:09:29 2006 +1100 @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-07-09.11 +scriptversion=2005-02-09.22 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -17,8 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -467,8 +467,7 @@ done "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile"
--- a/include/mlmmj-sub.h Thu Feb 09 18:06:12 2006 +1100 +++ b/include/mlmmj-sub.h Fri Feb 10 17:09:29 2006 +1100 @@ -26,9 +26,14 @@ #include <mlmmj.h> +void moderate_sub(const char *listdir, const char *listaddr, + const char *listdelim, const char *subaddr, + const char *mlmmjsend, enum subtype typesub, + int do_moderate); void confirm_sub(const char *listdir, const char *listaddr, const char *listdelim, const char *subaddr, - const char *mlmmjsend, enum subtype typesub); + const char *mlmmjsend, enum subtype typesub, + int do_moderate); void generate_subconfirm(const char *listdir, const char *listadr, const char *listdelim, const char *subaddr, const char *mlmmjsend, enum subtype typesub);
--- a/install-sh Thu Feb 09 18:06:12 2006 +1100 +++ b/install-sh Fri Feb 10 17:09:29 2006 +1100 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-05-14.22 +scriptversion=2005-02-02.21 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the
--- a/missing Thu Feb 09 18:06:12 2006 +1100 +++ b/missing Fri Feb 10 17:09:29 2006 +1100 @@ -1,7 +1,7 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-06-08.21 +scriptversion=2005-02-08.22 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. @@ -19,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -297,9 +297,6 @@ # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 touch $file ;;
--- a/mkinstalldirs Thu Feb 09 18:06:12 2006 +1100 +++ b/mkinstalldirs Fri Feb 10 17:09:29 2006 +1100 @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2005-06-29.22 +scriptversion=2005-02-02.21 # Original author: Noah Friedman <friedman@prep.ai.mit.edu> # Created: 1993-05-16 @@ -12,7 +12,7 @@ # <automake-patches@gnu.org>. errstatus=0 -dirmode= +dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... @@ -103,21 +103,13 @@ for file do - case $file in - /*) pathcomp=/ ;; - *) pathcomp= ;; - esac - oIFS=$IFS - IFS=/ - set fnord $file + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift - IFS=$oIFS + pathcomp= for d do - test "x$d" = x && continue - - pathcomp=$pathcomp$d + pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac @@ -132,7 +124,7 @@ else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr= + lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then @@ -142,7 +134,7 @@ fi fi - pathcomp=$pathcomp/ + pathcomp="$pathcomp/" done done
--- a/src/Makefile.am Thu Feb 09 18:06:12 2006 +1100 +++ b/src/Makefile.am Fri Feb 10 17:09:29 2006 +1100 @@ -36,7 +36,7 @@ getlistaddr.c chomp.c random-int.c strgen.c \ subscriberfuncs.c print-version.c \ log_error.c mygetline.c prepstdreply.c memory.c \ - statctrl.c readn.c getlistdelim.c + statctrl.c readn.c getlistdelim.c ctrlvalues.c mlmmj_unsub_SOURCES = mlmmj-unsub.c writen.c mylocking.c \ getlistaddr.c chomp.c subscriberfuncs.c random-int.c \
--- a/src/Makefile.in Thu Feb 09 18:06:12 2006 +1100 +++ b/src/Makefile.in Fri Feb 10 17:09:29 2006 +1100 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -17,6 +17,8 @@ # +SOURCES = $(mlmmj_bounce_SOURCES) $(mlmmj_list_SOURCES) $(mlmmj_maintd_SOURCES) $(mlmmj_process_SOURCES) $(mlmmj_recieve_SOURCES) $(mlmmj_send_SOURCES) $(mlmmj_sub_SOURCES) $(mlmmj_unsub_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -113,7 +115,7 @@ subscriberfuncs.$(OBJEXT) print-version.$(OBJEXT) \ log_error.$(OBJEXT) mygetline.$(OBJEXT) prepstdreply.$(OBJEXT) \ memory.$(OBJEXT) statctrl.$(OBJEXT) readn.$(OBJEXT) \ - getlistdelim.$(OBJEXT) + getlistdelim.$(OBJEXT) ctrlvalues.$(OBJEXT) mlmmj_sub_OBJECTS = $(am_mlmmj_sub_OBJECTS) mlmmj_sub_LDADD = $(LDADD) am_mlmmj_unsub_OBJECTS = mlmmj-unsub.$(OBJEXT) writen.$(OBJEXT) \ @@ -245,7 +247,7 @@ getlistaddr.c chomp.c random-int.c strgen.c \ subscriberfuncs.c print-version.c \ log_error.c mygetline.c prepstdreply.c memory.c \ - statctrl.c readn.c getlistdelim.c + statctrl.c readn.c getlistdelim.c ctrlvalues.c mlmmj_unsub_SOURCES = mlmmj-unsub.c writen.c mylocking.c \ getlistaddr.c chomp.c subscriberfuncs.c random-int.c \
--- a/src/mlmmj-sub.c Thu Feb 09 18:06:12 2006 +1100 +++ b/src/mlmmj-sub.c Fri Feb 10 17:09:29 2006 +1100 @@ -51,19 +51,21 @@ void moderate_sub(const char *listdir, const char *listaddr, const char *listdelim, const char *subaddr, - const char *mlmmjsend, enum subtype typesub) + const char *mlmmjsend, enum subtype typesub, + int do_moderate) { int i, fd; - char *a, *queuefilename, *fromaddr, *listname, *listfqdn, *listtext; - char *modfilename, *randomstr, *str, *listdelim, *mods; + char *a = NULL, *queuefilename, *from, *listname, *listfqdn, *str; + char *modfilename, *randomstr, *mods, *to, *replyto, *moderators = NULL; struct strlist *submods; + pid_t pid; char *maildata[6] = { "subaddr", NULL, "moderateaddr", NULL, "moderators", NULL }; submods = ctrlvalues(listdir, "submod"); /* no subscriber moderation wanted */ - if(submods == NULL) + if(submods == NULL || do_moderate == 0) return; /* generate the file in moderation/ */ @@ -95,17 +97,13 @@ fd = open(modfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); } if(fd < 0) { - log_error(LOG_ARGS, "could not create %s", modfilename); - log_error(LOG_ARGS, "ignoring request: %s", str); - myfree(modfilename); - myfree(str); + log_error(LOG_ARGS, "could not create %s" + "ignoring request: %s", str); exit(EXIT_FAILURE); } if(writen(fd, str, strlen(str)) < 0) { - log_error(LOG_ARGS, "could not write to %s", modfilename); - log_error(LOG_ARGS, "ignoring request: %s", str); - myfree(modfilename); - myfree(str); + log_error(LOG_ARGS, "could not write to %s" + "ignoring request: %s", str); exit(EXIT_FAILURE); } @@ -114,18 +112,17 @@ myfree(str); /* check to see if there's adresses in the submod control file */ + mods = concatstr(2, listdir, "/control/submod"); for(i = 0; i < submods->count; i++) a = strchr(submods->strs[i], '@'); - mods = concatstr(2, listdir, "/control/submod"); - /* no addresses in submod control file, use owner */ if(a == NULL) { + mods = concatstr(2, listdir, "/control/owner"); /* free the submods struct from above */ for(i = 0; i < submods->count; i++) myfree(submods->strs[i]); myfree(submods->strs); - mods = concatstr(2, listdir, "/control/owner"); } /* send mail to requester that the list is submod'ed */ @@ -145,23 +142,24 @@ myfree(str); } - maildata[1] = subaddr; + maildata[1] = mystrdup(subaddr); maildata[3] = replyto; maildata[5] = moderators; queuefilename = prepstdreply(listdir, "submod-moderator", "$listowner$", to, replyto, 3, maildata); - myfree(listdelim); - myfree(listname); - myfree(listfqdn); + myfree(maildata[1]); + /* we need to exec more than one mlmmj-send */ + pid = fork(); - if((fd = open(queuefilename, O_RDONLY) < 0)) { - log_error(LOG_ARGS, "Could not open '%s'", queuefilename); - log_error(LOG_ARGS, "Request in %s not served", modfilename); - myfree(queuefilename); - - execlp(mlmmjsend, mlmmjsend, + if(pid < 0) { + log_error(LOG_ARGS, "Could not fork for mlmmj-send" + "Request in %s not served", modfilename); + exit(EXIT_FAILURE); + } + if(pid == 0) { + execl(mlmmjsend, mlmmjsend, "-a", "-l", "4", "-L", listdir, @@ -169,15 +167,40 @@ "-F", from, "-R", replyto, "-m", queuefilename, (char *)NULL); + log_error(LOG_ARGS, "execl() of '%s' failed", mlmmjsend); + } + myfree(from); + myfree(to); + myfree(replyto); + myfree(moderators); + myfree(queuefilename); + + from = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); + queuefilename = prepstdreply(listdir, "submod-requester", "$listowner$", + subaddr, NULL, 0, NULL); + + myfree(listname); + myfree(listfqdn); + execl(mlmmjsend, mlmmjsend, + "-l", "1", + "-L", listdir, + "-T", subaddr, + "-F", from, + "-m", queuefilename, (char *)NULL); + log_error(LOG_ARGS, "execl() of '%s' failed", mlmmjsend); } void confirm_sub(const char *listdir, const char *listaddr, const char *listdelim, const char *subaddr, - const char *mlmmjsend, enum subtype typesub) + const char *mlmmjsend, enum subtype typesub, + int do_moderate) { char *queuefilename, *fromaddr, *listname, *listfqdn, *listtext; + moderate_sub(listdir, listaddr, listdelim, subaddr, mlmmjsend, + typesub, do_moderate); + listname = genlistname(listaddr); listfqdn = genlistfqdn(listaddr); @@ -622,7 +645,7 @@ if(childpid < 0) { log_error(LOG_ARGS, "Could not fork"); confirm_sub(listdir, listaddr, listdelim, address, - mlmmjsend, typesub); + mlmmjsend, typesub, 1); } if(childpid > 0) { @@ -634,7 +657,7 @@ /* child confirms subscription */ if(childpid == 0) confirm_sub(listdir, listaddr, listdelim, address, - mlmmjsend, typesub); + mlmmjsend, typesub, 1); } notifysub = statctrl(listdir, "notifysub");