Rick,
As requested I have attached the .qmail and .vpopmail files in the user 
directory patch.  I do not use this patch but created it a little while 
ago incase I did want to migrate to using .vpopmail files.
As far as I can remember the order of name resolution is as follows :-

1) .qmail-{extension} - Open if exists
2) .vpopmail-{extension} - Open if exists
3) Chop the end off the extension (back to the last '-')
4) .qmail-{extension}-default - Open if exists
5) .vpopmail-{extension}-default - Open if exists
6) Loop back to 3 until the extension is empty
7) If no file got opened from 1-6 then just bail, otherwise follow the 
instructions in the opened file.

You do still need to combine this patch with the deleiveredto patch (from 
my previous email) to get it all to work properly.

As far as maintaining the order in .qmail file using valias, I am pretty 
sure that they are maintained in .qmail files.  As far as the SQL is 
concerned I am not sure (I don't use SQL), do you want me to look into 
this ?

On Tue, 12 Dec 2006, Rick Widmer wrote:

> 
> 
> [EMAIL PROTECTED] wrote:
> 
> 
>  > Patches attached :-
>  > 1) vpopmail-5.4.13-dot-qmail.patch - Implements .qmail-extension 
> (etc) > in the users directory.
> 
> Nice.
> 
>  > 3) vpopmail-5.4.17-valias.patch - Changes to valias to remove SQL only
>  > restriction and implement alias line removal.
> 
> Very nice!
> 
>  > 4) vpopmail-5.4.17-vpopmaild.patch - Implements list_alias and
>  > list_lists commands using the new valias code.
> 
> Very nice!
> 
> 
> > As far as the second patch goes, it just implements what I think is a 
> > missing feature from the commandline 'valias', and that is the ability to 
> > remove a line from an alias (either .qmail file or SQL backend).  This 
> > patch also removes the SQL only restriction.
> 
> Next we need the ability to guarantee the order of the lines in both 
> .qmail and SQL back ends...
> 
> 
> > I know most of the community only want to use SQL backends, I however do 
> > not, so I have been patching vpopmail for a while now so the file backend 
> > works.
> 
> I'm not so sure about most.  I use cdb, and so does everyone else that 
> uses the Shupp toaster as written.
> 
> 
> > While scanning the vpopmaild.c code, I noticed a comment in there that the 
> > list_alias and list_lists commands needed re-writing to use the new valias 
> > code, this is what I have done.  This removes the need for the bkscandir 
> > function (although that patch does not remove it).  Also the output of 
> > these commands does not display the leading .qmail (as the old commands 
> > did), this is probably correct for both file and SQL backends.
> 
> THANKS!
> 
> 
> > Note: I also have a patch which is the same as 1) but does not call the 
> > files in the users .qmail, instead calls them .vpopmail files.  I 
> > personaly prefer .qmail files so vpopmail looks like a qmail installation 
> > as far as users are concerned.
> 
> I have mixed feelings about this.  I'm sure Charles Cazabon on the qmail 
> list would rejoice if we did this.  On the other hand we seem to be 
> moving towards having all the functionality of .qmail files built into 
> vdelivermail, which would also take care of his objections.
> 
> The best solution would probably be to read both .vpopmail and .qmail 
> files in the user directories, and start naming files executed by 
> vdelivermail .vpopmail.  I'd like to see this patch...
> 
> > If there are any bugs in these patches, please let me know.
> 
> I hope to find some time this weekend.  There are a number of features 
> I've wished for for quite some time...
> 
> THANKS!
> Rick
> 
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;

Reply via email to