Hi everybody,

I found that there are a couple of serious logic errors in the
valias/vdelivermail code.  In 3 seperate places the return code from
deliver_mail is not checked.  That means that if a valias is local and
can't be delivered, the mail will go into the ether.  Bad stuff.

Patch is attached. Where the return value is currently checked, a
vexit(100) is used.  I use vexit(111) instead, since in my opinion those
are temporary errors and the email shouldn't actually bounce.  Also, I
think MOST of the vexits in vdelivermail.c should be defers.  The only
time it should bounce would be when there is no configured recipient.
Any system error, looping, etc should defer it so when the sysadmin
fixes it the email gets delivered. Other opinions may differ, but that's
mine :)

Ole Gjerde

diff -ur vpopmail-5.3.20-orig/vdelivermail.c vpopmail-5.3.20-new/vdelivermail.c
--- vpopmail-5.3.20-orig/vdelivermail.c	2003-04-05 10:17:15.000000000 -0600
+++ vpopmail-5.3.20-new/vdelivermail.c	2003-07-11 14:30:26.000000000 -0500
@@ -279,7 +279,14 @@
         found = 1;
 
         /* deliver the mail */
-        deliver_mail(tmpstr, "NOQUOTA");
+        int ret = deliver_mail(tmpstr, "NOQUOTA");
+        if (ret == -2) {
+            printf("system error\n");
+            vexit(111);
+        } else if (ret == -3) {
+            printf("mail is looping");
+            vexit(111);
+        }
 
         /* Get the next alias for this [EMAIL PROTECTED] */
         tmpstr = valias_select_next();
@@ -301,7 +308,14 @@
             found = 1;
 
             /* deliver the mail */
-            deliver_mail(tmpstr, "NOQUOTA");
+            int ret = deliver_mail(tmpstr, "NOQUOTA");
+            if (ret == -2) {
+                printf("system error\n");
+                vexit(111);
+            } else if (ret == -3) {
+                printf("mail is looping\n");
+                vexit(111);
+            }
 
             /* Get the next alias for this [EMAIL PROTECTED] */
             tmpstr = valias_select_next();
@@ -748,7 +762,14 @@
          */
         if ( strcmp( qmail_line, tmpbuf) == 0 ) continue;
 
-        deliver_mail(qmail_line, "NOQUOTA");
+        int ret = deliver_mail(qmail_line, "NOQUOTA");
+        if (ret == -2) {
+            printf("system error\n");
+            vexit(111);
+        } else if (ret == -3) {
+            printf("mail is looping\n");
+            vexit(111);
+        }
         return_value = 1;
     }
 

Reply via email to