Hi,
Am 17.08.2011 17:03, schrieb Tom Collins:
"if (dbuf)" will always be true, since you're referring to the array.
oops, I fixed that.
I
think you want "if (*dbuf)" (e.g., if the first character of dbuf is not
null). Likewise, your test of "strcmp(dir,"")==0" would be clearer as
just "*dir == '\0'".
I think comparing strings with strcmp ist OK.
Use "strcpy" instead of "sprintf" to copy strings like this:
sprintf(dbuf,"digest").
thats right, fixed.
A new patch is attached.
with kind regards,
Robert Schulze
!DSPAM:4e4ccfa632711476228483!
--- mailinglist.c.orig 2011-08-17 15:53:26.000000000 +0200
+++ mailinglist.c 2011-08-18 10:35:25.000000000 +0200
@@ -665,6 +665,7 @@
int handles[2],pid,z = 0,subuser_count = 0;
char buf[256];
char *addr;
+ char dbuf[10]="";
if ( AdminType!=DOMAIN_ADMIN ) {
snprintf (StatusMessage, sizeof(StatusMessage), "%s", html_text[142]);
@@ -680,14 +681,21 @@
close(handles[0]);
dup2(handles[1],fileno(stdout));
sprintf(TmpBuf1, "%s/ezmlm-list", EZMLMDIR);
+
if(mod == 1) {
- sprintf(TmpBuf2, "%s/%s/mod", RealDir, ActionUser);
+ strcpy(dbuf,"mod");
} else if(mod == 2) {
- sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
- } else {
- sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+ strcpy(dbuf,"digest");
+ }
+
+ sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+
+ if(strcmp(dbuf,"")!=0) {
+ execl(TmpBuf1, "ezmlm-list", TmpBuf2, dbuf, NULL);
+ }
+ else {
+ execl(TmpBuf1, "ezmlm-list", TmpBuf2, NULL);
}
- execl(TmpBuf1, "ezmlm-list", TmpBuf2, NULL);
exit(127);
} else {
close(handles[1]);
@@ -799,9 +807,16 @@
pid=fork();
if (pid==0) {
snprintf(subpath, sizeof(subpath), "%s/ezmlm-sub", EZMLMDIR);
- snprintf(listpath, sizeof(listpath), "%s/%s/%s",
- RealDir, ActionUser, dir);
- execl(subpath, "ezmlm-sub", listpath, email, NULL);
+ snprintf(listpath, sizeof(listpath), "%s/%s/",
+ RealDir, ActionUser);
+
+ if(strcmp(dir,"")==0) {
+ execl(subpath, "ezmlm-sub", listpath, email, NULL);
+ }
+ else {
+ execl(subpath, "ezmlm-sub", listpath, dir, email, NULL);
+ }
+
exit(127);
} else wait(&pid);
@@ -870,6 +885,7 @@
{
int pid;
char *p;
+ char dbuf[10]="";
if ( AdminType!=DOMAIN_ADMIN ) {
snprintf (StatusMessage, sizeof(StatusMessage), "%s", html_text[142]);
@@ -889,13 +905,18 @@
if (pid==0) {
sprintf(TmpBuf1, "%s/ezmlm-unsub", EZMLMDIR);
if(mod == 1) {
- sprintf(TmpBuf2, "%s/%s/mod", RealDir, ActionUser);
+ strcpy(dbuf,"mod");
} else if(mod == 2 ) {
- sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
- } else {
- sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+ strcpy(dbuf,"digest");
+ }
+
+ sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
+ if(strcmp(dbuf,"")==0) {
+ execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, Newu, NULL);
+ }
+ else {
+ execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, dbuf, Newu, NULL);
}
- execl(TmpBuf1, "ezmlm-unsub", TmpBuf2, Newu, NULL);
exit(127);
} else wait(&pid);