Re: qmailadmin has problems with ezmlm-idx 7.0.2: Patch

"Tom Collins" <[email protected]>
Newsgroups gmane.mail.qmail.admin
Message-ID <[email protected]>
"if (dbuf)" will always be true, since you're referring to the array.  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'".

Use "strcpy" instead of "sprintf" to copy strings like this:
sprintf(dbuf,"digest").

But then again, why bother -- here's a better solution:

char *dbuf = NULL:
...
dbuf = "digest";
...
if (dbuf) {
...
}

Does anyone have suggestions for how to support both versions of ezmlm in
the qmailadmin codebase?  Compile-time check which sets a configuration
macro?

-Tom

Sirko Zidlewitz wrote:
> My Collegue Robert Schulze <[email protected]> has written a patch
> for mailinglist.c, but it is for qmailadmin 1.2.15.
> It works for us. Thanks Rob.
>
>
>
> --- mailinglist.c.orig	2011-08-17 15:53:26.000000000 +0200
> +++ mailinglist.c	2011-08-17 15:53:32.000000000 +0200
> @@ -665,6 +665,7 @@
>   int handles[2],pid,z = 0,subuser_count = 0;   char buf[256];
>   char *addr;
> + char dbuf[10]={0};
>     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);
> +	sprintf(dbuf,"mod");
>      } else if(mod == 2) {
> -        sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
> -    } else {
> -        sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
> +	sprintf(dbuf,"digest");
> +    }
> +
> +    sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
> +
> +    if(dbuf) {
> +	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]={0};
>     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);
> +	sprintf(dbuf,"mod");
>      } else if(mod == 2 ) {
> -        sprintf(TmpBuf2, "%s/%s/digest", RealDir, ActionUser);
> -    } else {
> -        sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
> +	sprintf(dbuf,"digest");
> +    }
> +
> +    sprintf(TmpBuf2, "%s/%s/", RealDir, ActionUser);
> +    if(!dbuf) {
> +       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);
>
>
> 
>
>


-- 
Tom Collins
[email protected]


!DSPAM:4e4bd83732711373790421!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.