Hello ,

This patch makes vpopbull work with multiple domains in the argument
The base 5.4.10 only processes the first domain due to nested use of
strtok !!!!

--- ../vpopmail-5.4.10-IPLNet-9/vpopbull.c      2004-01-11 09:16:53.000000000 
+0000
+++ vpopbull.c  2005-05-18 14:00:30.000000000 +0100
@@ -127,16 +127,16 @@
   }
 
   if (( EmailFile[0] != 0 || DoNothing == 1) && Domain[0] != 0 ) {
-
+       char *idx;
     /* Process list of domains */
-    domain = strtok(Domain, " ");
+    domain = strtok_r(Domain, " ",&idx);
     while (domain != NULL ) {
         if((vget_assign(domain, domain_dir, sizeof(domain_dir), NULL, NULL)) 
!= NULL) {
             process_domain(domain,  fsi, fsx );
         } else {
             fprintf(stderr, "Error: domain %s does not exist\n", domain);
         }
-        domain = strtok(NULL, " ");
+        domain = strtok_r(NULL, " ",&idx);
     }
     vexit(0);
 
@@ -150,11 +150,12 @@
     }
 
     while ( fgets(TmpBuf, sizeof(TmpBuf), fsassign) != NULL ) {
-      if ( (alias=strtok(TmpBuf, TOKENS)) == NULL ) continue;
-      if ( (domain=strtok(NULL, TOKENS)) == NULL ) continue;
-      if ( (tmpstr=strtok(NULL, TOKENS)) == NULL ) continue;
-      if ( (tmpstr=strtok(NULL, TOKENS)) == NULL ) continue;
-      if ( (domain_dir=strtok(NULL, TOKENS)) == NULL ) continue;
+           char *idx;
+      if ( (alias=strtok_r(TmpBuf, TOKENS,&idx)) == NULL ) continue;
+      if ( (domain=strtok_r(NULL, TOKENS,&idx)) == NULL ) continue;
+      if ( (tmpstr=strtok_r(NULL, TOKENS,&idx)) == NULL ) continue;
+      if ( (tmpstr=strtok_r(NULL, TOKENS,&idx)) == NULL ) continue;
+      if ( (domain_dir=strtok_r(NULL, TOKENS,&idx)) == NULL ) continue;
       alias++;  /* point past leading + */
       alias[strlen(alias)-1] = '\0';  /* remove trailing - */
       if (strcmp (alias, domain) != 0) {


-- 
Best regards,
 Pedro                          mailto:[EMAIL PROTECTED]

Reply via email to