We have recently noticed strange behaviour with our cyrus-imapd-1.0.14
installation. Lmtpd does not seem to forward auto-generated error messages
properly. When a cyrus-imap user sends a mail to a non-existent address, the other
MTA will typically respond with an error message with a null envelope sender
address: '<>'. Suppose now that this cyrus-imap user also has a sieve forward rule
which will forward this error message to another address. In our case, when lmtpd
forwards the mail by calling sendmail, it seems to be trying to set the sender
address (with the -f option) to the empty return-path: value, generating something
like:

sendmail -f  -- <rcpt to> ...

Consequently, the mail is sent with "--@ourimap" as the envelope sender. A local
MTA rejects this mail, sending another error message back to "--@ourimap", which
of course does not exist. I imaging it should be forwarded with "sendmail -f <> --
<rcpt to>".

I think there may be two bugs here. Firstly, in send_forward() in lmtpd.c we have:

    smbuf[0] = "sendmail";
    if (return_path != NULL) {
        smbuf[1] = "-f";
        smbuf[2] = return_path;
    } else {
        smbuf[1] = "-f";
        smbuf[2] = "<>";
    }
    smbuf[3] = "--";
    smbuf[4] = forwardto;

Should the second line not be "if (return_path != '')" ? I think I'm right in
saying that if the original message had an "<>" envelope sender, then return_path
will be empty here, and hence the problem.

Secondly, in savemsg() in lmtpengine.c we have:

        if (!strchr(rpath, '@')) {
            hostname = config_servername;
        }
 
        fprintf(f, "Return-Path: <%s%s%s>\r\n",
                rpath, hostname ? "@" : "", hostname ? hostname : "");

which explains why messages generated by a sieve vacation rule (where the envelope
sender will be "<>) have:

        "Return-Path: <@imapdomain>"

I think this might be fixed in the cvs, but I'm not sure.

Thanks.

-- 

Stephen Grier                           [EMAIL PROTECTED]
Systems Developer       
Computing Services
Queen Mary, University of London

Reply via email to