summaryrefslogtreecommitdiffstats
path: root/qmail-remote.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2014-05-20 00:23:52 +0200
committermanuel <manuel@mausz.at>2014-05-20 00:23:52 +0200
commit74ed200b0d1b98c7da6312ba361fead608a5a315 (patch)
tree9adbb365678973b07b343cb99c5380ca6767080a /qmail-remote.c
parentc67d7d47af6838d0df89fa5072d6c1248eadf29d (diff)
downloadqmail-74ed200b0d1b98c7da6312ba361fead608a5a315.tar.gz
qmail-74ed200b0d1b98c7da6312ba361fead608a5a315.tar.bz2
qmail-74ed200b0d1b98c7da6312ba361fead608a5a315.zip
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
Diffstat (limited to 'qmail-remote.c')
-rw-r--r--qmail-remote.c5
1 files changed, 3 insertions, 2 deletions
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()
569#endif 569#endif
570 570
571 code = smtpcode(); 571 code = smtpcode();
572 if (code >= 500) quit("DConnected to "," but greeting failed"); 572 if (code >= 500 && code < 600) quit("DConnected to "," but greeting failed");
573 if (code >= 400 && code < 500) return; /* try next MX, see RFC-2821 */
573 if (code != 220) quit("ZConnected to "," but greeting failed"); 574 if (code != 220) quit("ZConnected to "," but greeting failed");
574 575
575#ifdef EHLO 576#ifdef EHLO
@@ -948,7 +949,7 @@ char **argv;
948#ifdef TLS 949#ifdef TLS
949 partner_fqdn = ip.ix[i].fqdn; 950 partner_fqdn = ip.ix[i].fqdn;
950#endif 951#endif
951 smtp(); /* does not return */ 952 smtp(); /* only returns when the next MX is to be tried */
952 } 953 }
953 tcpto_err(&ip.ix[i].ip,errno == error_timeout); 954 tcpto_err(&ip.ix[i].ip,errno == error_timeout);
954 close(smtpfd); 955 close(smtpfd);