As you may have noticed, when you added a mailing list, you got the
following in the forward:
[EMAIL PROTECTED] -A -B -D -F -G -H -I -J
-L -M -O -p -p -Q -R -S
-T -U
As reported by Leung Yau Wai.
As it turns out there is a bug with how qmailadmin handles executing
ezmlm-make. Here is the description:
qmailadmin uses execl( ) ... this is great, except it does not do any
command line parsing, instead execl assumes you have already parsed each
argument into its own string. ie:
execl( BinaryPath, "programname",
"arg1", "arg2", "arg3", NULL ) ;
would be the equivalent of:
system( "programname arg1 arg2 arg3");
The problem occurs because qmailadmin puts the following as _ONE_
parameter:
"-5 [EMAIL PROTECTED] -A -B -D -F -G -H -I -J -L -M -O -p -p -Q
-R -S
-T -U"
So instad of seeing 18 different command line options, ezmlm-make sees 1
option with a large email address "[EMAIL PROTECTED] -A -B -D -F
-G -H -I -J -L -M -O -p -p -Q -R -S
-T -U"
in other words this is quite clearly incorrect.
There is a happy ending however. I wrote a patch which does The Right
Thing (tm) in a fairly clean way which should be extensible. I have
attached the patch (very small) which should be ok, I have made it work
with my system, it relies on strdup() which may not be a good thing, but
it was easiest...
If you think you can do better than strdup, go ahead.
There might be other failure modes similar to this one in the code, but
I havent checked...
PS: I didnt test the sql hookup, so someone with that ability might want
to do that.
Regards,
-ryan
--
Ryan Rawson
System Administrator
Binary Environments Ltd.
[EMAIL PROTECTED]
diff -u -r qmailadmin-0.30/mailinglist.c qmailadmin-0.30-fixed/mailinglist.c
--- qmailadmin-0.30/mailinglist.c Fri May 12 04:36:24 2000
+++ qmailadmin-0.30-fixed/mailinglist.c Wed Jun 21 12:34:07 2000
@@ -254,6 +254,8 @@
char options[MAX_BUFF];
char tmp[MAX_BUFF];
char loop_ch[MAX_BUFF];
+ char *opts[MAX_EZMLM_OPTS] ;
+ int opt = 0 ; /* option counter */
int loop;
#endif
@@ -278,11 +280,23 @@
memset(options, 0, MAX_BUFF);
memset(loop_ch, 0, MAX_BUFF);
+
+ for( loop = 0 ; loop < MAX_EZMLM_OPTS ; loop++ ) {
+ opts[loop] = NULL ;
+ }
+
+ /* first argument is the name of the program by convention */
+ opts[opt++] = strdup( "ezmlm-make" ) ;
GetValue(TmpCGI, list_owner, "5=", MAX_BUFF); // Get the listowner
strcat(options, "-5 ");
strcat(options, list_owner);
- strcat(options, " ");
+
+ /* change strdup? */
+ opts[opt++] = strdup( options ) ;
+
+ memset(options, 0, MAX_BUFF );
+
#if DEBUG
fprintf(actout, "5=%s\n<br>", list_owner);
#endif
@@ -290,8 +304,7 @@
{
sprintf(tmp, "param%d=", loop+1);
GetValue(TmpCGI, loop_ch, tmp, MAX_BUFF);
- strcat(options, loop_ch);
- strcat(options, " ");
+ opts[opt++] = strdup(loop_ch) ;
}
memset(tmp, 0, MAX_BUFF);
GetValue(TmpCGI, tmp, "sqlsupport=", MAX_BUFF);
@@ -299,8 +312,8 @@
fprintf(actout, "sqlsupport=%s\n<br>", tmp);
#endif
if( !tmp ) {
- strcat(options, tmp);
- strcat(options, " ");
+ opts[opt++] = strdup( tmp ) ;
+
for(loop = 0; loop < NUM_SQL_OPTIONS; loop++)
{
sprintf(tmp, "sql%d=", loop+1);
@@ -308,6 +321,8 @@
strcat(options, loop_ch);
if(loop < NUM_SQL_OPTIONS - 1) strcat(options, ":");
}
+ opts[opt++] = strdup( options ) ;
+ memset( options, 0, MAX_BUFF ) ;
}
#if DEBUG
fprintf(actout, "Options=%s\n<br>", options);
@@ -317,16 +332,31 @@
pid=fork();
if (pid==0) {
+#ifdef EZMLMIDX
+ char buf[1000] ;
+ buf[0] = '\0';
+#endif
sprintf(TmpBuf1, "%s/ezmlm-make", EZMLMDIR);
sprintf(TmpBuf2, "%s/domains/%s/%s", Vpophome, Domain, ActionUser);
sprintf(TmpBuf3, "%s/domains/%s/.qmail-%s", Vpophome, Domain,
ActionUser);
#ifdef EZMLMIDX
- execl(TmpBuf1, "ezmlm-make", options, TmpBuf2, TmpBuf3, ActionUser,
Domain , NULL);
+ opts[opt++] = strdup( TmpBuf2 ) ;
+ opts[opt++] = strdup( TmpBuf3 ) ;
+ opts[opt++] = strdup( ActionUser ) ;
+ opts[opt++] = strdup( Domain ) ;
+
+ execv( TmpBuf1, opts ) ;
#else
execl(TmpBuf1, "ezmlm-make", TmpBuf2, TmpBuf3, ActionUser, Domain ,
NULL);
#endif
exit(127);
} else wait(&pid);
+
+#ifdef EZMLMIDX
+ for( loop = 0 ; loop < MAX_EZMLM_OPTS ; ++ loop )
+ if( opts[loop] )
+ free( opts[loop] ) ;
+#endif
sprintf(TmpBuf, "%s/domains/%s/%s/inlocal",
Vpophome, Domain, ActionUser);
diff -u -r qmailadmin-0.30/qmailadmin.h qmailadmin-0.30-fixed/qmailadmin.h
--- qmailadmin-0.30/qmailadmin.h Fri May 12 04:36:24 2000
+++ qmailadmin-0.30-fixed/qmailadmin.h Wed Jun 21 12:18:44 2000
@@ -41,3 +41,16 @@
#define NUM_EZMLM_CHOICES 18
#define NUM_SQL_OPTIONS 6
+/* 1 extra for owner,
+ 1 extra for argv[0]
+ 1 extra for ezmlm directory
+ 1 extra for .qmail
+ 1 extra for localname
+ 1 extra for domain
+ 2 extra for SQL options
+ 1 extra for NULL termination
+ ------------------
+ 9 extras
+*/
+#define MAX_EZMLM_OPTS (NUM_EZMLM_CHOICES+9)
+