Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -513,11 +513,29 @@ # Last resort, may be Windows if {[is_mingw]} { define-append LIBS -lwsock32 } } -cc-check-function-in-lib ns_name_uncompress resolv + +# The SMTP module requires special libraries and headers for MX DNS +# record lookups and such. +cc-check-includes arpa/nameser.h +cc-include-needs bind/resolv.h netinet/in.h +cc-check-includes bind/resolv.h +cc-check-includes resolv.h +if { !(([cc-check-function-in-lib dn_expand resolv] || + [cc-check-function-in-lib ns_name_uncompress {bind resolv}] || + [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) && + ([cc-check-function-in-lib ns_parserr {bind resolv}] || + [cc-check-function-in-lib __ns_parserr {bind resolv}]) && + ([cc-check-function-in-lib res_query {bind resolv}] || + [cc-check-function-in-lib __res_query {bind resolv}]))} { + msg-result "WARNING: SMTP feature will not be able to look up local MX." +} +cc-check-function-in-lib res_9_ns_initparse resolv + +# Other nonstandard function checks cc-check-functions utime cc-check-functions usleep cc-check-functions strchrnul cc-check-functions pledge cc-check-functions backtrace Index: src/smtp.c ================================================================== --- src/smtp.c +++ src/smtp.c @@ -19,15 +19,27 @@ ** to RFC 5321. */ #include "config.h" #include "smtp.h" #include -#if defined(__linux__) && !defined(FOSSIL_OMIT_DNS) +#if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \ + (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS) # include # include -# include -# include +# if defined(HAVE_BIND_RESOLV_H) +# include +# include +# else +# include +# include +# endif +# if defined(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand) +# define dn_expand ns_name_uncompress +# endif +# if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand) +# define dn_expand __ns_name_uncompress +# endif # define FOSSIL_UNIX_STYLE_DNS 1 #endif #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) # include # include @@ -77,12 +89,11 @@ iBestPriority = priority; } } } if( pBest ){ - ns_name_uncompress(aDns, aDns+nDns, pBest+2, - zHostname, sizeof(zHostname)); + dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname)); return fossil_strdup(zHostname); } return 0; #elif defined(FOSSIL_WINDOWS_STYLE_DNS) DNS_STATUS status; /* Return status */