]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.1-20150712
authorWietse Venema <wietse@porcupine.org>
Sun, 12 Jul 2015 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 12 Jul 2015 15:57:19 +0000 (11:57 -0400)
31 files changed:
postfix/HISTORY
postfix/WISHLIST
postfix/html/dnsblog.8.html
postfix/html/oqmgr.8.html
postfix/html/postconf.5.html
postfix/html/postscreen.8.html
postfix/html/qmgr.8.html
postfix/makedefs
postfix/man/man5/postconf.5
postfix/man/man8/dnsblog.8
postfix/man/man8/oqmgr.8
postfix/man/man8/postscreen.8
postfix/man/man8/qmgr.8
postfix/mantools/postlink
postfix/proto/postconf.proto
postfix/src/dns/Makefile.in
postfix/src/dns/dns_lookup.c
postfix/src/dnsblog/dnsblog.c
postfix/src/global/mail_params.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/oqmgr/qmgr.c
postfix/src/oqmgr/qmgr_deliver.c
postfix/src/oqmgr/qmgr_transport.c
postfix/src/postscreen/postscreen.c
postfix/src/postscreen/postscreen_dnsbl.c
postfix/src/qmgr/qmgr.c
postfix/src/qmgr/qmgr_deliver.c
postfix/src/qmgr/qmgr_transport.c
postfix/src/smtp/smtp_addr.c
postfix/src/util/peekfd.c

index 95855af9b80ada361452cf02e3781c5d3b23d0a9..58e997ee8f96e2991a4b6b3a07d8e5dcffc0fa34 100644 (file)
@@ -21812,3 +21812,14 @@ Apologies for any names omitted.
        Workaround: conditional time default value can result in
        multiple time unit suffixes. Files: global/conv_time.c
        global/mail_conf_time.c.
+
+20150712
+
+       Cleanup: code indentation. Viktor Dukhovni. File:
+       smtp/smtp_addr.c.
+
+       Workaround: With Solaris10, write_wait() hangs in poll()
+       until timeout, when invoked after peekfd() has received an
+       ECONNRESET error indication. This happens when a client
+       sends QUIT and closes the connection immediately. File:
+       util/peekfd.c.
index eaeb18738fe35b49809044a1b32f96a33bd71482..e222bc001cd6fb430615ac1f88b8f7e1682bf791 100644 (file)
@@ -10,8 +10,6 @@ Wish list:
 
        Things to do after the stable release:
 
-       Make the dns_res_query() workaround on/off configurable.
-
        TLS certificate provenance: indicate whether a subject
        name/issuer are verified or not (for example, change the
        attribute name to unverified_ccert_subject etc.).  This is
@@ -28,9 +26,6 @@ Wish list:
        Update the list of Sendmail macros that Postfix can send
        to Milters (auth_ssf and TLS-related).
 
-       replace str*casecmp() calls with _utf8() equivalents
-       for trivial-rewrite lookups.
-
        Update smtpd command count when rejecting input before
        command-table lookup.
 
@@ -68,12 +63,6 @@ Wish list:
        support for regexp: and cidr: tables. Factor out and reuse
        code that already exists in inline: and other tables.
 
-       Solaris poll() does not work as expected. With Solaris10,
-       write_wait() hangs until timeout when invoked after peekfd()
-       has received an ECONNRESET error indication. This happens
-       when a client sends QUIT and closes the connection immediately.
-       Apparently the ECONNRESET error condition is not persistent.
-
        Log command=good/bad statistics in postscreen?
 
        Implement smtpd_client_auth_rate limit?
index b1ca0e66a250718e73c537d063f23e233cfab3a9..6b29cccb85daac2481defb30c79334ced591a6d3 100644 (file)
@@ -88,5 +88,10 @@ DNSBLOG(8)                                                          DNSBLOG(8)
        P.O. Box 704
        Yorktown Heights, NY 10598, USA
 
+       Wietse Venema
+       Google, Inc.
+       111 8th Avenue
+       New York, NY 10011, USA
+
                                                                     DNSBLOG(8)
 </pre> </body> </html>
index 3ad052dfb16cbffc13f2ab6252591b724a503bb4..d97ffc8d260cd923539d45b2eceaed801e043d8a 100644 (file)
@@ -382,5 +382,10 @@ OQMGR(8)                                                              OQMGR(8)
        P.O. Box 704
        Yorktown Heights, NY 10598, USA
 
+       Wietse Venema
+       Google, Inc.
+       111 8th Avenue
+       New York, NY 10011, USA
+
                                                                       OQMGR(8)
 </pre> </body> </html>
index 160b0e42578ea5d35898dfbafe0cef1fde60e0bc..34a3d3520d6d74cd3017a50cbfccc015e9b6d473 100644 (file)
@@ -2944,6 +2944,19 @@ Example:
 </pre>
 
 
+</DD>
+
+<DT><b><a name="dns_ncache_ttl_fix_enable">dns_ncache_ttl_fix_enable</a>
+(default: no)</b></DT><DD>
+
+<p> Enable a workaround for future libc incompatibility. The Postfix
+implementation of <a href="http://tools.ietf.org/html/rfc2308">RFC 2308</a> negative reply caching relies on the
+promise that res_query() and res_search() invoke res_send(), which
+returns the server response in an application buffer even if the
+requested record does not exist. If this promise is broken, specify
+"yes" to enable a  workaround for DNS reputation lookups. </p>
+
+
 </DD>
 
 <DT><b><a name="dnsblog_reply_delay">dnsblog_reply_delay</a>
index 09cd0e170167e419a107749a66595a904f6e0fc2..6bdb0e248b3a844dac1cd77b0ff5d39d0efca18e 100644 (file)
@@ -121,6 +121,11 @@ POSTSCREEN(8)                                                    POSTSCREEN(8)
               auth, etc.) that the <a href="postscreen.8.html"><b>postscreen</b>(8)</a> server will not send  in  the
               EHLO response to a remote SMTP client.
 
+       Available in Postfix version 3.1 and later:
+
+       <b><a href="postconf.5.html#dns_ncache_ttl_fix_enable">dns_ncache_ttl_fix_enable</a> (no)</b>
+              Enable a workaround for future libc incompatibility.
+
 <b>TROUBLE SHOOTING CONTROLS</b>
        <b><a href="postconf.5.html#postscreen_expansion_filter">postscreen_expansion_filter</a> (see 'postconf -d' output)</b>
               List     of     characters     that     are     permitted     in
@@ -422,5 +427,10 @@ POSTSCREEN(8)                                                    POSTSCREEN(8)
        P.O. Box 704
        Yorktown Heights, NY 10598, USA
 
+       Wietse Venema
+       Google, Inc.
+       111 8th Avenue
+       New York, NY 10011, USA
+
                                                                  POSTSCREEN(8)
 </pre> </body> </html>
index 34a8ca760d4ab14e75e6ac43b69218f6e64dadfd..7f2225d4cfa150ef1314692321fdceadb6d9f150 100644 (file)
@@ -450,5 +450,10 @@ QMGR(8)                                                                QMGR(8)
        Modra 6
        155 00, Prague, Czech Republic
 
+       Wietse Venema
+       Google, Inc.
+       111 8th Avenue
+       New York, NY 10011, USA
+
                                                                        QMGR(8)
 </pre> </body> </html>
index 2ce0774db049fa0601bbd559a8e087bb9ea7cd2f..052cf9b98b00723072ee25917bbfb0f6f3077bcd 100644 (file)
@@ -817,7 +817,7 @@ CCARGS="$CCARGS -DSNAPSHOT"
 
 # Non-production: needs thorough testing, or major changes are still
 # needed before the code stabilizes.
-CCARGS="$CCARGS -DNONPROD"
+#CCARGS="$CCARGS -DNONPROD"
 
 # Workaround: prepend Postfix include files before other include files.
 CCARGS="-I. -I../../include $CCARGS"
index 042cbdc53b9448e7d6d3f81c7fb8388af3b8696d..c777be115b5a0a2b8d3c36ace389c11be036fa30 100644 (file)
@@ -1844,6 +1844,13 @@ disable_vrfy_command = no
 .fi
 .ad
 .ft R
+.SH dns_ncache_ttl_fix_enable (default: no)
+Enable a workaround for future libc incompatibility. The Postfix
+implementation of RFC 2308 negative reply caching relies on the
+promise that res_query() and res_search() invoke res_send(), which
+returns the server response in an application buffer even if the
+requested record does not exist. If this promise is broken, specify
+"yes" to enable a  workaround for DNS reputation lookups.
 .SH dnsblog_reply_delay (default: 0s)
 A debugging aid to artificially delay DNS responses.
 .PP
index c36bfbcb84e3255140df9b9a30288bb60e179acd..b3c7c9b00ebfa278e1b529f97819814e1ca0217e 100644 (file)
@@ -94,3 +94,8 @@ Wietse Venema
 IBM T.J. Watson Research
 P.O. Box 704
 Yorktown Heights, NY 10598, USA
+
+Wietse Venema
+Google, Inc.
+111 8th Avenue
+New York, NY 10011, USA
index f9f07554ee5f240573a620c415928bf58a054c5c..46514085ab483bdc60da023213719bc989768f07 100644 (file)
@@ -382,3 +382,8 @@ Wietse Venema
 IBM T.J. Watson Research
 P.O. Box 704
 Yorktown Heights, NY 10598, USA
+
+Wietse Venema
+Google, Inc.
+111 8th Avenue
+New York, NY 10011, USA
index faeda727448ccd5fc1918f683b73308660e07cd2..02052948194b56e8437bcc8766597198e7b93119 100644 (file)
@@ -139,6 +139,10 @@ to a remote SMTP client.
 A case insensitive list of EHLO keywords (pipelining, starttls,
 auth, etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO
 response to a remote SMTP client.
+.PP
+Available in Postfix version 3.1 and later:
+.IP "\fBdns_ncache_ttl_fix_enable (no)\fR"
+Enable a workaround for future libc incompatibility.
 .SH "TROUBLE SHOOTING CONTROLS"
 .na
 .nf
@@ -443,3 +447,8 @@ Wietse Venema
 IBM T.J. Watson Research
 P.O. Box 704
 Yorktown Heights, NY 10598, USA
+
+Wietse Venema
+Google, Inc.
+111 8th Avenue
+New York, NY 10011, USA
index 0e395c362971a1fbfd3caca40ba7520142400f13..400f789c5c0b90f1b4be4ac4b512b8f3e1f90401 100644 (file)
@@ -436,3 +436,8 @@ Preemptive scheduler enhancements:
 Patrik Rak
 Modra 6
 155 00, Prague, Czech Republic
+
+Wietse Venema
+Google, Inc.
+111 8th Avenue
+New York, NY 10011, USA
index 2557555e115ff15aceb813e212aa321cf916597c..9f6f30d5d1cc89f1711ca999c7d7be0f8026709c 100755 (executable)
@@ -982,6 +982,7 @@ while (<>) {
     s;\bmulti_instance_enable\b;<a href="postconf.5.html#multi_instance_enable">$&</a>;g;
 
     # postscreen
+    s;\bdns_ncache_ttl_fix_enable\b;<a href="postconf.5.html#dns_ncache_ttl_fix_enable">$&</a>;g;
     s;\bdnsblog_reply_delay\b;<a href="postconf.5.html#dnsblog_reply_delay">$&</a>;g;
     s;\bpostscreen_cache_map\b;<a href="postconf.5.html#postscreen_cache_map">$&</a>;g;
     s;\bpostscreen_cache_cleanup_interval\b;<a href="postconf.5.html#postscreen_cache_cleanup_interval">$&</a>;g;
index 08d3a95b57e83324a53994b0282059181d91eb5c..2dda03c83fb20202c9f8957c3776a132628d83b7 100644 (file)
@@ -16557,4 +16557,11 @@ exponentially.
 This feature is available in Postfix 3.0 and later.
 </p>
 
-
+%PARAM dns_ncache_ttl_fix_enable no
+
+<p> Enable a workaround for future libc incompatibility. The Postfix
+implementation of RFC 2308 negative reply caching relies on the
+promise that res_query() and res_search() invoke res_send(), which
+returns the server response in an application buffer even if the
+requested record does not exist. If this promise is broken, specify
+"yes" to enable a  workaround for DNS reputation lookups. </p>
index 878fd692c09d8fc4066afe125ee8eb3354b0465f..81fcc5d5617e3a182acbb9e3e6c16aac98eeba66 100644 (file)
@@ -278,6 +278,7 @@ depend: $(MAKES)
 dns_lookup.o: ../../include/argv.h
 dns_lookup.o: ../../include/check_arg.h
 dns_lookup.o: ../../include/dict.h
+dns_lookup.o: ../../include/mail_params.h
 dns_lookup.o: ../../include/maps.h
 dns_lookup.o: ../../include/msg.h
 dns_lookup.o: ../../include/myaddrinfo.h
index a89d2a468fb56483dc666112dcbe33fc1a6c7052..fe59aa64745215e853360f0755602e8c2c3225b8 100644 (file)
@@ -32,7 +32,7 @@
 /*     int     lflags;
 /*     unsigned *ltype;
 /* AUXILIARY FUNCTIONS
-/*     int     dns_ncache_ttl_fix_enable;
+/*     extern int var_dns_ncache_ttl_fix;
 /*
 /*     int     dns_lookup_r(name, type, rflags, list, fqdn, why, rcode)
 /*     const char *name;
@@ -89,7 +89,7 @@
 /*     dns_lookup_x, dns_lookup_r(), dns_lookup_rl() and dns_lookup_rv()
 /*     accept or return additional information.
 /*
-/*     The dns_ncache_ttl_fix_enable variable controls a workaround
+/*     The var_dns_ncache_ttl_fix variable controls a workaround
 /*     for res_search(3) implementations that break the
 /*     DNS_REQ_FLAG_NCACHE_TTL feature. The workaround does not
 /*     support EDNS0 or DNSSEC, but it should be sufficient for
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
 #include <valid_hostname.h>
 #include <stringops.h>
 
+/* Global library. */
+
+#include <mail_params.h>
+
 /* DNS library. */
 
 #define LIBDNS_INTERNAL
@@ -280,23 +289,22 @@ typedef struct DNS_REPLY {
   * Unfortunately, the res_search() and res_query() API gets in the way. These
   * functions overload their result value, the server reply length, and
   * return -1 when the requested record does not exist. With libbind-based
-  * res_search() implementations, the server response is still available in a
-  * caller-supplied buffer, thanks to a promise made by res_send() and the
-  * functions that depend on it. With some creativity we can still use the
-  * server response.
+  * implementations, the server response is still available in an application
+  * buffer, thanks to the promise that res_query() and res_search() invoke
+  * res_send(), which returns the full server response even if the requested
+  * record does not exist.
   * 
-  * If this should stop working (for example, res_search() does not call
+  * If this promise is broken (for example, res_search() does not call
   * res_send(), but some non-libbind implementation that updates the
-  * caller-supplied buffer only when the requested record exists), then we
-  * have a way out by setting the dns_ncache_ttl_fix_enable variable. This
-  * enables a limited res_query() clone that should be sufficient for DNSBL /
-  * DNSWL lookups.
+  * application buffer only when the requested record exists), then we have a
+  * way out by setting the var_dns_ncache_ttl_fix variable. This enables a
+  * limited res_query() clone that should be sufficient for DNSBL / DNSWL
+  * lookups.
   * 
   * The libunbound API does not comingle the reply length and reply status
   * information, but that will have to wait until it is safe to make
   * libunbound a mandatory dependency for Postfix.
   */
-int     dns_ncache_ttl_fix_enable = 0;
 
 /* dns_res_query - a res_query() clone that can return negative replies */
 
@@ -457,7 +465,7 @@ static int dns_query(const char *name, int type, unsigned flags,
     for (;;) {
        _res.options &= ~saved_options;
        _res.options |= flags;
-       if (keep_notfound && dns_ncache_ttl_fix_enable) {
+       if (keep_notfound && var_dns_ncache_ttl_fix) {
            len = dns_res_query((char *) name, C_IN, type, reply->buf,
                                reply->buf_len);
        } else {
index a9de032d72fec1b2a1d84e64bed9c79b89e4a060..29a987b6d9148adeea4eaeb90aff03792131fa7c 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 7d027faf4949164b429d9952f1b504df227b5531..d72c6b968257394c23e53dc49ba7b6074348a0aa 100644 (file)
@@ -327,6 +327,7 @@ char   *var_multi_name;
 bool    var_multi_enable;
 bool    var_long_queue_ids;
 bool    var_daemon_open_fatal;
+bool    var_dns_ncache_ttl_fix;
 char   *var_dsn_filter;
 int     var_smtputf8_enable;
 int     var_strict_smtputf8;
@@ -630,6 +631,7 @@ void    mail_params_init()
     static const CONFIG_BOOL_TABLE first_bool_defaults[] = {
        /* read and process the following before opening tables. */
        VAR_DAEMON_OPEN_FATAL, DEF_DAEMON_OPEN_FATAL, &var_daemon_open_fatal,
+       VAR_DNS_NCACHE_TTL_FIX, DEF_DNS_NCACHE_TTL_FIX, &var_dns_ncache_ttl_fix,
        0,
     };
     static const CONFIG_NBOOL_TABLE first_nbool_defaults[] = {
index d1d339b4d61473f13e16d331701a1808b1024a55..e10cfe40380e726cfa521fb4c8389802dd73c258 100644 (file)
@@ -3922,6 +3922,18 @@ extern int var_strict_smtputf8;
                                        MAIL_SRC_NAME_VERIFY
 extern char *var_smtputf8_autoclass;
 
+ /*
+  * Workaround for future incompatibility. Our implementation of RFC 2308
+  * negative reply caching relies on the promise that res_query() and
+  * res_search() invoke res_send(), which returns the server response in an
+  * application buffer even if the requested record does not exist. If this
+  * promise is broken, we have a workaround that is good enough for DNS
+  * reputation lookups.
+  */
+#define VAR_DNS_NCACHE_TTL_FIX         "dns_ncache_ttl_fix_enable"
+#define DEF_DNS_NCACHE_TTL_FIX         0
+extern bool var_dns_ncache_ttl_fix;
+
 /* LICENSE
 /* .ad
 /* .fi
index 9d20656aa82e86e14a4e74e4f4af73b4f43ec081..e78cfdbd6398c9dacb44f0873ba6ccc09d0a38f5 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20150711"
+#define MAIL_RELEASE_DATE      "20150712"
 #define MAIL_VERSION_NUMBER    "3.1"
 
 #ifdef SNAPSHOT
index b291b8690beaedfb5f0a1f4e68c2fd44bfdc57b1..cca95c773a93ad29747d35dcdf1207b5460af465 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 02db6b93aefc88b494c21529137e862fd8ba1a75..d8ec7bb00accf9ead847f10408424814243ef3c9 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index cb26453f05061431e9b911c29914d66f6a8fd144..ed780db71a26e1c37469cc8caacccd491c515ec9 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 923cbff047b96f089a89533bf2aee39e85246333..3eca2d44df7cb977bbd447f90d4bc20786e681e6 100644 (file)
 /*     A case insensitive list of EHLO keywords (pipelining, starttls,
 /*     auth, etc.) that the \fBpostscreen\fR(8) server will not send in the EHLO
 /*     response to a remote SMTP client.
+/* .PP
+/*     Available in Postfix version 3.1 and later:
+/* .IP "\fBdns_ncache_ttl_fix_enable (no)\fR"
+/*     Enable a workaround for future libc incompatibility.
 /* TROUBLE SHOOTING CONTROLS
 /* .ad
 /* .fi
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 34d586202b4288862fa5afec35f95afff8d21d03..788b8d8b12943682658f079104eec1a5be464b18 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 25359df9d4d0949d36c9b86e8ed5a7ed34b27f1c..137cd93080c9c2fefe3a5a960d7d258c2139b1e5 100644 (file)
 /*     Patrik Rak
 /*     Modra 6
 /*     155 00, Prague, Czech Republic
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index 575f7591240e5b8e061558dc8e1ae99c0eb10642..fe4cf0ca5be14826f438ebb5f4af6cf9a09296c9 100644 (file)
 /*     Patrik Rak
 /*     Modra 6
 /*     155 00, Prague, Czech Republic
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index a5089f493731d3c8955769c01e0f1b85f62d08d9..fe99806739489153baf3a31dcad9c9c0d9fbe7ab 100644 (file)
 /*     Patrik Rak
 /*     Modra 6
 /*     155 00, Prague, Czech Republic
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* System library. */
index d02b2531918e89b639b95d699c4b11b1395c3102..d9de504bd185bf53abee418db6c0b0daee3d4e2e 100644 (file)
@@ -134,6 +134,7 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, const char *host, int res_opt,
     struct addrinfo *res0;
     struct addrinfo *res;
     INET_PROTO_INFO *proto_info = inet_proto_info();
+    unsigned char *proto_family_list = proto_info->sa_family_list;
     int     found;
 
     if (msg_verbose)
@@ -143,14 +144,14 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, const char *host, int res_opt,
      * Interpret a numerical name as an address.
      */
     if (hostaddr_to_sockaddr(host, (char *) 0, 0, &res0) == 0) {
-       if (strchr((char *) proto_info->sa_family_list, res0->ai_family) != 0) {
-       if ((addr = dns_sa_to_rr(host, pref, res0->ai_addr)) == 0)
-           msg_fatal("host %s: conversion error for address family %d: %m",
-                   host, ((struct sockaddr *) (res0->ai_addr))->sa_family);
-       addr_list = dns_rr_append(addr_list, addr);
-       freeaddrinfo(res0);
-       return (addr_list);
-    }
+       if (strchr((char *) proto_family_list, res0->ai_family) != 0) {
+           if ((addr = dns_sa_to_rr(host, pref, res0->ai_addr)) == 0)
+               msg_fatal("host %s: conversion error for address family "
+                         "%d: %m", host, res0->ai_addr->sa_family);
+           addr_list = dns_rr_append(addr_list, addr);
+           freeaddrinfo(res0);
+           return (addr_list);
+       }
        freeaddrinfo(res0);
     }
 
@@ -214,15 +215,15 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, const char *host, int res_opt,
                       host, MAI_STRERROR(aierr));
        } else {
            for (found = 0, res = res0; res != 0; res = res->ai_next) {
-               if (strchr((char *) proto_info->sa_family_list, res->ai_family) == 0) {
+               if (strchr((char *) proto_family_list, res->ai_family) == 0) {
                    msg_info("skipping address family %d for host %s",
                             res->ai_family, host);
                    continue;
                }
                found++;
                if ((addr = dns_sa_to_rr(host, pref, res->ai_addr)) == 0)
-                   msg_fatal("host %s: conversion error for address family %d: %m",
-                   host, ((struct sockaddr *) (res0->ai_addr))->sa_family);
+                   msg_fatal("host %s: conversion error for address family "
+                             "%d: %m", host, res0->ai_addr->sa_family);
                addr_list = dns_rr_append(addr_list, addr);
            }
            freeaddrinfo(res0);
index f142f262aa785cee0f9e363243e050ba63c5d119..a3273f16f44f503eedb8fb18f4626b37d03e9ea4 100644 (file)
 #endif
 #include <unistd.h>
 
+#ifndef SHUT_RDWR
+#define SHUT_RDWR  2
+#endif
+
 /* Utility library. */
 
 #include "iostuff.h"
@@ -57,7 +61,23 @@ ssize_t peekfd(int fd)
 #ifdef FIONREAD
     int     count;
 
+#ifdef SUNOS5
+
+    /*
+     * With Solaris10, write_wait() hangs in poll() until timeout, when
+     * invoked after peekfd() has received an ECONNRESET error indication.
+     * This happens when a client sends QUIT and closes the connection
+     * immediately.
+     */
+    if (ioctl(fd, FIONREAD, (char *) &count) < 0) {
+       (void) shutdown(fd, SHUT_RDWR);
+       return (-1);
+    } else {
+       return (count);
+    }
+#else                                          /* SUNOS5 */
     return (ioctl(fd, FIONREAD, (char *) &count) < 0 ? -1 : count);
+#endif                                         /* SUNOS5 */
 #else
 #error "don't know how to look ahead"
 #endif