From 74ed200b0d1b98c7da6312ba361fead608a5a315 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 20 May 2014 00:23:52 +0200 Subject: Fix qmail-remote to handle multiple MX records correctly as in rfc2821 This patch changes qmail-remote to skip over MX servers that greet with codes 400 to 499 and to bounce mail when any MX server that qmail tries greets with a code 500 to 599. see http://www-dt.e-technik.uni-dortmund.de/~ma/qmail/patch-qmail-1.03-rfc2821.diff --- qmail-remote.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qmail-remote.c') diff --git a/qmail-remote.c b/qmail-remote.c index be997f0..dc00d08 100644 --- a/qmail-remote.c +++ b/qmail-remote.c @@ -569,7 +569,8 @@ void smtp() #endif code = smtpcode(); - if (code >= 500) quit("DConnected to "," but greeting failed"); + if (code >= 500 && code < 600) quit("DConnected to "," but greeting failed"); + if (code >= 400 && code < 500) return; /* try next MX, see RFC-2821 */ if (code != 220) quit("ZConnected to "," but greeting failed"); #ifdef EHLO @@ -948,7 +949,7 @@ char **argv; #ifdef TLS partner_fqdn = ip.ix[i].fqdn; #endif - smtp(); /* does not return */ + smtp(); /* only returns when the next MX is to be tried */ } tcpto_err(&ip.ix[i].ip,errno == error_timeout); close(smtpfd); -- cgit v1.2.3