From cbe47d6e376117e13efc35b45eb42013fdb88a85 Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Fri, 29 Dec 2006 00:00:00 -0500 Subject: [PATCH] postfix-2.3.6-RC3 --- postfix/HISTORY | 6 ++++++ postfix/src/global/mail_version.h | 4 ++-- postfix/src/smtpd/smtpd_check.c | 24 ++++++++++++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index b596e7d6a..130858ec6 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -12899,3 +12899,9 @@ Apologies for any names omitted. insertion point. Thus, inserting headers at positions (N, N+M) could work as if (N, N) had been specified. Problem reported by Mark Martinec. File: milter/milter8.c. + +20061227 + + Bugfix: the MX hostname syntax check was accidentally skipped + with reject_unknown_helo_hostname/sender_domain/recipient_domain. + File: smtpd/smtpd_check.c. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 3118e3ba5..66203d0f3 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20061224" -#define MAIL_VERSION_NUMBER "2.3.6-RC2" +#define MAIL_RELEASE_DATE "20061229" +#define MAIL_VERSION_NUMBER "2.3.6-RC3" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 80d41ac25..c0a227d68 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1142,6 +1142,7 @@ static int reject_unknown_hostname(SMTPD_STATE *state, char *name, { const char *myname = "reject_unknown_hostname"; int dns_status; + DNS_RR *dummy; if (msg_verbose) msg_info("%s: %s", myname, name); @@ -1152,15 +1153,20 @@ static int reject_unknown_hostname(SMTPD_STATE *state, char *name, #define RR_ADDR_TYPES T_A #endif - dns_status = dns_lookup_l(name, 0, (DNS_RR **) 0, (VSTRING *) 0, + dns_status = dns_lookup_l(name, 0, &dummy, (VSTRING *) 0, (VSTRING *) 0, DNS_REQ_FLAG_STOP_OK, RR_ADDR_TYPES, T_MX, 0); + if (dummy) + dns_rr_free(dummy); if (dns_status != DNS_OK) { /* incl. DNS_INVAL */ if (dns_status != DNS_RETRY) return (smtpd_check_reject(state, MAIL_ERROR_POLICY, var_unk_name_code, "4.7.1", - "<%s>: %s rejected: Host not found", - reply_name, reply_class)); + "<%s>: %s rejected: %s", + reply_name, reply_class, + dns_status == DNS_INVAL ? + "Malformed DNS server reply" : + "Host not found")); else DEFER_IF_PERMIT2(state, MAIL_ERROR_POLICY, 450, "4.7.1", @@ -1177,23 +1183,29 @@ static int reject_unknown_mailhost(SMTPD_STATE *state, const char *name, { const char *myname = "reject_unknown_mailhost"; int dns_status; + DNS_RR *dummy; if (msg_verbose) msg_info("%s: %s", myname, name); #define MAILHOST_LOOKUP_FLAGS (DNS_REQ_FLAG_STOP_OK | DNS_REQ_FLAG_STOP_INVAL) - dns_status = dns_lookup_l(name, 0, (DNS_RR **) 0, (VSTRING *) 0, + dns_status = dns_lookup_l(name, 0, &dummy, (VSTRING *) 0, (VSTRING *) 0, MAILHOST_LOOKUP_FLAGS, T_MX, RR_ADDR_TYPES, 0); + if (dummy) + dns_rr_free(dummy); if (dns_status != DNS_OK) { /* incl. DNS_INVAL */ if (dns_status != DNS_RETRY) return (smtpd_check_reject(state, MAIL_ERROR_POLICY, var_unk_addr_code, strcmp(reply_class, SMTPD_NAME_SENDER) == 0 ? "4.1.8" : "4.1.2", - "<%s>: %s rejected: Domain not found", - reply_name, reply_class)); + "<%s>: %s rejected: %s", + reply_name, reply_class, + dns_status == DNS_INVAL ? + "Malformed DNS server reply" : + "Domain not found")); else DEFER_IF_PERMIT2(state, MAIL_ERROR_POLICY, 450, strcmp(reply_class, SMTPD_NAME_SENDER) == 0 ?