Drew Wells wrote the following on 04/15/2008 02:13 AM:
I understand the problem you are trying to address here, but vpopmail is following qmail like behaviour when dealing with address extensions. As far as I understand it the .qmail file is never read when an address has an extension, this is the job of .qmail-default so maybe it would be more complete to get qmailadmin to create a .qmail-default file along with the .qmail file it creates. This will not affect older vpopmail's as they don't use anything other then .qmail files. I don't use qmailadmin but here is a patch I'm sure should do the trick

diff -uPr qmailadmin-1.2.11.orig/user.c qmailadmin-1.2.11/user.c
--- qmailadmin-1.2.11.orig/user.c    2006-08-29 17:57:35.000000000 +0100
+++ qmailadmin-1.2.11/user.c    2008-04-15 09:50:11.000000000 +0100
@@ -472,6 +472,14 @@
       fprintf(fs, "%s\n", SPAM_COMMAND);
#endif
       fclose(fs);
+ snprintf(NewBuf, sizeof(NewBuf), "%s/.qmail-default", mypw->pw_dir);
+       fs = fopen(NewBuf, "w+");
+#ifdef MODIFY_SPAM_NEED_EMAIL
+       fprintf(fs, "%s %s\n", SPAM_COMMAND, email);
+#else +       fprintf(fs, "%s\n", SPAM_COMMAND);
+#endif
+       fclose(fs);
    }
#endif

If you really want to do this the following patch will do the trick.

diff -uPr vpopmail-5.4.25.orig/vdelivermail.c vpopmail-5.4.25/vdelivermail.c --- vpopmail-5.4.25.orig/vdelivermail.c 2008-01-15 11:21:51.000000000 +0000
+++ vpopmail-5.4.25/vdelivermail.c    2008-04-15 09:33:47.000000000 +0100
@@ -810,7 +810,7 @@
int check_forward_deliver(char *dir)
{
 static char qmail_line[500];
- FILE *fs;
+ FILE *fs = NULL;
 int i;
 int return_value = 0;

@@ -837,13 +837,14 @@
                }
            }
        }
-    } else {
-        fs = fopen(".qmail","r");
    }
-#else
-    fs = fopen(".qmail","r");
#endif

+ /* no .qmail-ext file fallback to the .qmail file (non-qmail behaviour) */
+    if (fs == NULL) {
+        fs = fopen(".qmail","r");
+    }
+
    /* no .qmail file at all */
    if (fs == NULL ) {
        /* no file, so just return */

Michael McCallister wrote:
Michael McCallister wrote the following on 04/10/2008 11:09 AM:
Michael McCallister wrote the following on 04/07/2008 11:11 PM:
I ran across a minor, but highly annoying issue in a recent toaster migration and was wondering if anyone here had advice as to a workaround. On both installs (old and the new), I have vpopmail compiled with --enable-qmail-ext. I also used the qmailadmin to --enable-modify-spam and set --enable-spam-command=|/var/qmail/bin/preline /usr/local/bin/maildrop /home/vpopmail/etc/mailfilter . This worked great on the old system and also worked when someone used a "qmail-ext" - in other words, emails addressed to [EMAIL PROTECTED] and [EMAIL PROTECTED] both got run through the corresponding mailfilter - because the .qmail file right outside of Maildir (the one placed there by qmailadmin) was read in either scenario.

With the latest toaster that I migrated to - only emails without "-ext" (i.e. [EMAIL PROTECTED]) run through mailfilter as normal. The rest (i.e. emails addressed to [EMAIL PROTECTED]) just get dropped in the inbox and so maildrop never has a chance to run. For people who get a lot of spam sent to their "-ext" addresses, this can be annoying because all that spam that used to get deleted or dropped into a Spam folder is now going to the Inbox. On the old server, I was running vpopmail-5.4.1 / toaster-scripts-0.6 / qmailadmin-1.2.1 / maildrop-1.6.3 and on the new server I am running the most recent toaster: vpopmail-5.4.18 / toaster-scripts-0.9.0 / qmailadmin-1.2.11 / maildrop-2.0.4

Tried to Google for the answer for a while, but found nothing - also searched the list archives. I apologize if this issue is obvious / already covered. I am hoping there is some workaround that I can use to bypass this issue. Any help is appreciated.

Michael

Tom Collins posted this email on the vpopmail mailing list concerning this issue: http://www.mail-archive.com/[EMAIL PROTECTED]/msg25622.html At least I think it may be concerning this issue - I am not familiar with the code and can only read C to the extent that I can program in Perl. Basically, when address extensions are delivered, vdelivermail (with the current toaster version) completely ignores .qmail files and just delivers to Maildir. So the the .qmail file created by qmailadmin is overlooked. Using the current toaster code it looks like this:
#ifdef QMAIL_EXT
    /* format the file name */
    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);
    }
But according to Tom it should look like this (I think):
fs = NULL;
#ifdef QMAIL_EXT
    /* format the file name */
    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;
                    }
                }
            }
        }
    }
#endif
if (fs == NULL) fs = fopen (".qmail", "r");

    /* no .qmail file at all */
    if (fs == NULL ) {
        /* no file, so just return */
        return(-1);
    }
Am I heading in the right direction here? I don't completely feel familiar/comfortable doing this, so thought I would ask the list. Can I just update the vdelivermail.c, run a make clean, run make again, and then just overwrite the existing vdelivermail with the new version (after backing it up of course)?

Ok - I tried it out and Tom's patch does seem to fix this issue. Thanks Tom!


Thanks Drew,

That makes sense. I like the idea of sticking with default qmailish behavior - assuming your patch works, I think this is a better approach. It is confusing for some vpopmail users since the old version of vdelivermail from vpopmail-5.4.1 did read in .qmail files, but later versions do not. I am not sure if I will have the chance to give your patch a chance though because it is a production server with many thousands of accounts and I am hesitant to patch things - especially now that everything is working correctly.

Michael

Reply via email to