Just in case anyone was using them attached are the patches for 5.4.15 to 
enable per-user .qmail files.  I use per user .qmail files in a live 
environment so have to do these patch files anyway.
diff -uPr vpopmail-5.4.15.orig/vdelivermail.c vpopmail-5.4.15/vdelivermail.c
--- vpopmail-5.4.15.orig/vdelivermail.c 2005-11-19 16:24:22.000000000 +0000
+++ vpopmail-5.4.15/vdelivermail.c      2006-03-14 15:51:31.000000000 +0000
@@ -62,6 +62,7 @@
 #ifdef QMAIL_EXT
 /* the User with '-' and following chars out if any */
 char TheUserExt[AUTH_SIZE]; 
+char TheExt[AUTH_SIZE];
 #endif
 
 #define FILE_SIZE 156
@@ -217,6 +218,11 @@
         vexit(EXIT_BOUNCE);
     }
 
+    strncpy(TheExt, &TheUser[i+1], AUTH_SIZE);
+    for (i = 0; (TheExt[i] != 0); i++) {
+       if (TheExt[i] == '.') TheExt[i] = ':';
+    }
+
 #endif
 
     vget_assign(TheDomain, TheDomainDir, sizeof(TheDomainDir), &TheDomainUid, 
&TheDomainGid);
@@ -698,14 +704,34 @@
     chdir(dir);
 
     /* format the file name */
-    if ( (fs = fopen(".qmail","r")) == NULL ) {
-
-        /* no file, so just return */
-        return(-1);
+#ifdef QMAIL_EXT
+    if (strlen(TheExt)) {
+       strcpy(tmpbuf,".qmail-");
+       strcat(tmpbuf,TheExt);
+       if ( (fs = fopen(tmpbuf,"r")) == NULL ) {
+           for (i = strlen(TheExt);i>=0;i--) {
+               if (!i || TheExt[i-1]=='-') {
+                   strcpy(tmpbuf,".qmail-");
+                   strncat(tmpbuf,TheExt,i);
+                   strcat(tmpbuf,"default");
+                   if ( (fs = fopen(tmpbuf,"r")) != NULL ) {
+                       break;
+                   }
+               }
+           }
+       }
+    } else {
+       fs = fopen(".qmail","r");
     }
+#else
+    fs = fopen(".qmail","r");
+#endif
 
-    /* format a simple loop checker name */
-    snprintf(tmpbuf, sizeof(tmpbuf), "[EMAIL PROTECTED]", TheUser, TheDomain);
+    /* no .qmail file at all */
+    if (fs == NULL) {
+       /* no file, so just return */
+       return(-1);
+    }
 
     /* read the file, line by line */
     while ( fgets(qmail_line, sizeof(qmail_line), fs ) != NULL ) {
@@ -719,14 +745,6 @@
             if (qmail_line[i] == '\n') qmail_line[i] = 0;
         }
 
-        /* simple loop check, if they are sending it to themselves
-         * then skip this line
-         */
-        if ( strcmp( qmail_line, tmpbuf) == 0 ) continue;
-        /* check for &[EMAIL PROTECTED] as well */
-        if ((*qmail_line == '&') && (strcmp (qmail_line + 1, tmpbuf) == 0))
-            continue;
-
         deliver_mail(qmail_line, "");
 
         return_value = 1;
diff -uPr vpopmail-5.4.15.orig/vdelivermail.c vpopmail-5.4.15/vdelivermail.c
--- vpopmail-5.4.15.orig/vdelivermail.c 2006-03-14 15:51:31.000000000 +0000
+++ vpopmail-5.4.15/vdelivermail.c      2006-03-14 15:59:07.000000000 +0000
@@ -505,6 +505,7 @@
  FILE *fs;
  char tmp_file[256];
  char maildirquota[80];
+ char *email;
 
     /* This is a comment, ignore it */
     if ( *address == '#' ) return;
@@ -603,15 +604,19 @@
         }
 #endif
 
+       /* Get the email address from the maildir */
+       email = maildir_to_email(address);
+
         /* Set the Delivered-To: header */
-        if ( strcmp( address, bounce) == 0 ) {
+        if ( strcmp( address, bounce ) == 0 ||
+            strcmp( email, "" ) == 0 ) {
             snprintf(DeliveredTo, sizeof(DeliveredTo), 
                 "%sDelivered-To: [EMAIL PROTECTED]", getenv("RPLINE"), 
                  TheUser, TheDomain);
         } else {
             snprintf(DeliveredTo, sizeof(DeliveredTo), 
                 "%sDelivered-To: %s\n", getenv("RPLINE"), 
-                maildir_to_email(address));
+                email);
         }
     
         switch (deliver_to_maildir (address, DeliveredTo, 0, message_size)) {

Reply via email to