Yep, it is exactly that.  At the moment I have all the files in 
~vpopmail/domains/<domainname>/<username> called '.qmail'.
I have attached the patch 'as is' that I have been using for a while now, 
and have also quickly modded the patch in include .vpopmail files (as a 
secondary to .qmail, please note this is untested) in the users directory.
I have also attached a patch which sort of takes care of the Delivered-To: 
line using either of the 2 above patches.

(just deals with .qmail's for now) and will modify it next 
week if needed.

On Fri, 16 Dec 2005, Charles J. Boening wrote:

> I thought that was the proposal.  To call the files .vpopamil files
> since vdelivermail was actually doing the delivery.  You'd still have
> .qmail files in the ~vpopmail/domains/<domainname> directory but the
> ~vpopmail/domains/<domainname>/<username> directory would have
> .vpopamail files.
> 
> Guess I'll have to go back and read again.
> 
> 
> Charlie
> 
>  
> 
> > -----Original Message-----
> > From: Jeremy Kister [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, December 16, 2005 2:21 PM
> > To: vchkpw@inter7.com
> > Subject: Re: [vchkpw] Per user .qmail patch
> > 
> > On 12/16/2005 3:00 PM, Charles J. Boening wrote:
> > > Don't really need a perl script.  This should work.
> > > 
> > > find /home/vpopmail/domains -name .qmail* | xargs -i rename qmail 
> > > vpopmail '{}'
> > 
> > from your suggestion, I think you're one of the people who 
> > are confused. :)
> > 
> > renaming all .qmail* files in ~vpopmail/domains will break 
> > your installation horribly.
> > 
> > -- 
> > 
> > Jeremy Kister
> > http://jeremy.kister.net./
> > 
> > 
> 
diff -uPr vpopmail-5.4.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c
--- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.000000000 +0100
+++ vpopmail-5.4.13/vdelivermail.c      2005-12-16 15:53:29.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);
@@ -697,16 +703,36 @@
    
     chdir(dir);
 
+#ifdef QMAIL_EXT
     /* format the file name */
-    if ( (fs = fopen(".qmail","r")) == NULL ) {
+    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
 
+    /* no .qmail file at all */
+    if (fs == NULL ) {
         /* no file, so just return */
         return(-1);
     }
 
-    /* format a simple loop checker name */
-    snprintf(tmpbuf, sizeof(tmpbuf), "[EMAIL PROTECTED]", TheUser, TheDomain);
-
     /* read the file, line by line */
     while ( fgets(qmail_line, sizeof(qmail_line), fs ) != NULL ) {
         if (*qmail_line == '#') continue;
@@ -716,14 +742,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.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c
--- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.000000000 +0100
+++ vpopmail-5.4.13/vdelivermail.c      2005-12-16 21:39:15.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);
@@ -697,16 +703,48 @@
    
     chdir(dir);
 
+#ifdef QMAIL_EXT
     /* format the file name */
-    if ( (fs = fopen(".qmail","r")) == NULL ) {
+    if (strlen(TheExt)) {
+        strcpy(tmpbuf,".qmail-");
+        strcat(tmpbuf,TheExt);
+        if ( (fs = fopen(tmpbuf,"r")) == NULL ) {
+            strcpy(tmpbuf,".vpopmail-");
+            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;
+                        }
+                        strcpy(tmpbuf,".vpopmail-");
+                        strncat(tmpbuf,TheExt,i);
+                        strcat(tmpbuf,"default");
+                        if ( (fs = fopen(tmpbuf,"r")) != NULL) {
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+    } else {
+        if ( (fs = fopen(".qmail","r")) == NULL) {
+            fs = fopen(".vpopmail","r");
+        }
+    }
+#else
+    fs = fopen(".qmail","r");
+#endif
 
+    /* no .qmail file at all */
+    if (fs == NULL ) {
         /* no file, so just return */
         return(-1);
     }
 
-    /* format a simple loop checker name */
-    snprintf(tmpbuf, sizeof(tmpbuf), "[EMAIL PROTECTED]", TheUser, TheDomain);
-
     /* read the file, line by line */
     while ( fgets(qmail_line, sizeof(qmail_line), fs ) != NULL ) {
         if (*qmail_line == '#') continue;
@@ -716,14 +754,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.13.orig/vdelivermail.c vpopmail-5.4.13/vdelivermail.c
--- vpopmail-5.4.13.orig/vdelivermail.c 2005-09-02 19:47:29.000000000 +0100
+++ vpopmail-5.4.13/vdelivermail.c      2005-11-24 13:06:22.000000000 +0000
@@ -499,6 +499,7 @@
  FILE *fs;
  char tmp_file[256];
  char maildirquota[80];
+ char *email;
 
     /* This is a comment, ignore it */
     if ( *address == '#' ) return;
@@ -597,15 +598,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