On 8 Aug 2001, John R. Levine wrote:

> Like I said:
> 
> > It's true, qmail doesn't work the way you might first have guessed it
> > does.  That doesn't mean it's wrong.

The fact qmail--or any other piece of software--does something does not
mean it is correct.

Executive summary: qmail breaks VERP under certain circumstances.

Let H be a host running qmail, A and B users at H, and V a virtual domain
redirected to B@H. Let X@V, i.e. B-X@H, be forwarded to some other, maybe
remote, address, say K@L. Now, let's assume A uses

        QMAILINJECT=r qmail-inject X@V

to send a "VERPed" message M to X@V. M is forwarded to K@L. Now, let's
assume the delivery to K@L fails and the message is bounced back to A.
Well, it should be bounced to A-X=V@M, shouldn't it? After all, A sent the
message to X@V, and VERP is supposed to preserve the *original* recipient
address. Indeed, qmail-inject's manpage says:

>        r      Use a per-recipient VERP.  qmail-inject will append each
>               recipient address to the envelope sender of the copy going
>               to that recipient.

Unfortunately, the return address in the scenario described above is

        A-B-X=V@M

Is A supposed to know "B-" is superflous (if and only if the domain is V!)
and should be removed? Is A supposed to analyze qmail's configurations
files in order to fix something that should have never been broken? (BTW:
I cannot find any code analyzing virtualdomains in ezmlm. Am I blind?)

A does not care what is recorded in Delivered-To or what a program run
from ~B/.qmail-V-... sees in its environment. A cares what qmail does when
he sends a message and asks qmail to use VERP.

Is this scenario purely artifical? Not at all. It is easy to imagine a
host run by some ISP-like company hosting both an email forwarding service
implemented as a virtual domain and some mailing lists.

Surprisingly, the fix appears to be almost a one-liner if we use the same
approach qmail-send itself uses to fix recipient addresses when it
generates a bounce. A *completely untested* patch is here:

--- qmail-send.c~       Mon Jun 15 12:53:16 1998
+++ qmail-send.c        Wed Aug  8 16:47:15 2001
@@ -162,6 +162,8 @@
   return 2;
 }
 
+char *stripvdomprepend(char *recip);
+
 void senderadd(sa,sender,recip)
 stralloc *sa;
 char *sender;
@@ -175,6 +177,7 @@
  if (i >= 4)
    if (str_equal(sender + i - 4,"-@[]"))
     {
+     recip = stripvdomprepend(recip);
      j = byte_rchr(sender,i - 4,'@');
      k = str_rchr(recip,'@');
      if (recip[k] && (j + 5 <= i))

I repeat: There is absolutely no guarantee this patch will work as
expected. It might cause syntax errors, it might transport all mail it
gets its hands on to the nearest blackhole, and it might even massacre all
your family with a chainsaw. Use at your own risk.

P.S. I wonder whether we will see any reaction from DJB himself.

--Pavel Kankovsky aka Peak  [ Boycott Microsoft--http://www.vcnet.com/bms ]
"Resistance is futile. Open your source code and prepare for assimilation."

Reply via email to