Hi all

I have noticed a bug in the lmtp relay code. When you have an action
like this:

> action "mailman-lmtp" relay host "lmtp://127.0.0.1:8024"

and a mail with more then one recipient hits this action the first
recipient gets relayed and the other recipients get a temporary error:

> 84b3d669d00f3903 mta delivery evpid=7446558dffc99e03 [email protected] 
> [email protected] rcpt=<-> source="127.0.0.1" relay="127.0.0.1 (localhost)" 
> delay=0s result="TempFail" stat="Remote host sent too much data"

This results in duplicated messages for the later recipients.

As far as I see the problem is in mta_io() which reads the first
response from the lmtp server and handles it. After that the IO_DATAIN
case doesn't check for the MTA_LMTP_EOM state. So the responses for
the secound (and more recipients) aren't handled correct.

I have written a patch for this, but not yet tested.

Philipp

diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c
index 4707419e..c168633f 100644
--- a/usr.sbin/smtpd/mta_session.c
+++ b/usr.sbin/smtpd/mta_session.c
@@ -1337,6 +1337,10 @@ mta_io(struct io *io, int evt, void *arg)
                        return;
                }
 
+               if (s->state == MTA_LMTP_EOM) {
+                       goto nextline;
+               }
+
                if (io_datalen(s->io)) {
                        log_debug("debug: mta: remaining data in input buffer");
                        mta_error(s, "Remote host sent too much data");
@@ -1677,6 +1681,7 @@ mta_strstate(int state)
        CASE(MTA_BANNER);
        CASE(MTA_EHLO);
        CASE(MTA_HELO);
+       CASE(MTA_LHLO);
        CASE(MTA_STARTTLS);
        CASE(MTA_AUTH);
        CASE(MTA_AUTH_PLAIN);


Reply via email to