From: Amos Jeffries Date: Fri, 4 Oct 2013 12:15:52 +0000 (-0600) Subject: Revert libresolv related changed of rev.13026 X-Git-Tag: SQUID_3_5_0_1~613 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=819656daa62ef15ed1954d543bde055665310c57;p=thirdparty%2Fsquid.git Revert libresolv related changed of rev.13026 This library API and hacks are still used by the Kerberos LDAP group helper for a custom SRV lookup. --- diff --git a/acinclude/os-deps.m4 b/acinclude/os-deps.m4 index add6a9be8c..8fb597e2c9 100644 --- a/acinclude/os-deps.m4 +++ b/acinclude/os-deps.m4 @@ -660,6 +660,133 @@ statvfs("/tmp", &sfs); SQUID_DEFINE_BOOL(HAVE_STATVFS,$ac_cv_func_statvfs,[set to 1 if our system has statvfs(), and if it actually works]) ]) + +dnl check that we can use the libresolv _dns_ttl_ hack +dnl sets the ac_cv_libresolv_dns_ttl_hack shell variable and defines LIBRESOLV_DNS_TTL_HACK + +AC_DEFUN([SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK],[ + AC_CACHE_CHECK(for libresolv _dns_ttl_ hack, ac_cv_libresolv_dns_ttl_hack, [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])], + [ac_cv_libresolv_dns_ttl_hack=yes],[ac_cv_libresolv_dns_ttl_hack=no]) ]) + SQUID_DEFINE_BOOL(LIBRESOLV_DNS_TTL_HACK,$ac_cv_libresolv_dns_ttl_hack, + [libresolv.a has been hacked to export _dns_ttl_]) +]) + + +dnl checks for availability of some resolver fields +dnl sets ac_cv_have_res_ext_nsaddr_list shell variable +dnl defines _SQUID_RES_NSADDR6_COUNT _SQUID_RES_NSADDR6_LARRAY +dnl defines _SQUID_RES_NSADDR6_LPTR _SQUID_RES_NSADDR6_COUNT +dnl defines _SQUID_RES_NSADDR_LIST _SQUID_RES_NSADDR_COUNT + +AC_DEFUN([SQUID_CHECK_RESOLVER_FIELDS],[ + AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +#if HAVE_RESOLV_H +#include +#endif + ]], + [[_res_ext.nsaddr_list[[0]].s_addr;]])],[ + ac_cv_have_res_ext_nsaddr_list="yes" ],[ + ac_cv_have_res_ext_nsaddr_list="no"])) + if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then + AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member]) + AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext]) + fi + +if test "$_SQUID_RES_NSADDR6_LIST" = ""; then + AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +#if HAVE_RESOLV_H +#include +#endif + ]], i + [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])], + [ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"])) + if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then + AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member]) + AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res]) + fi +fi + +AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list, + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +#if HAVE_RESOLV_H +#include +#endif + ]], [[_res.nsaddr_list[[0]];]])], + [ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"])) + if test $ac_cv_have_res_nsaddr_list = "yes" ; then + AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member]) + AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res]) + fi + + if test "$_SQUID_RES_NSADDR_LIST" = ""; then + AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_ARPA_INET_H +#include +#endif +#if HAVE_ARPA_NAMESER_H +#include +#endif +#if HAVE_RESOLV_H +#include +#endif + ]], + [[_res.ns_list[[0]].addr;]])], + [ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"])) + if test $ac_cv_have_res_ns_list = "yes" ; then + AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member]) + AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res]) + fi +fi +]) + + dnl checks the winsock library to use (ws2_32 or wsock32) dnl may set ac_cv_func_select as a side effect AC_DEFUN([SQUID_CHECK_WINSOCK_LIB],[ diff --git a/compat/os/linux.h b/compat/os/linux.h index 8c585055a8..da5111d7d8 100644 --- a/compat/os/linux.h +++ b/compat/os/linux.h @@ -13,6 +13,14 @@ #define _SQUID_LINUX_THREADS_ #endif +/* + * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu) + */ +#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init) +#define res_init __res_init +#define HAVE_RES_INIT HAVE___RES_INIT +#endif + /* * sys/capability.h is only needed in Linux apparently. * diff --git a/configure.ac b/configure.ac index de127d8c63..d238d694bc 100644 --- a/configure.ac +++ b/configure.ac @@ -2472,6 +2472,8 @@ AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works]) dnl Check for needed libraries AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind]) +AC_SEARCH_LIBS([res_init],[resolv]) +AC_SEARCH_LIBS([__res_search],[resolv]) AC_SEARCH_LIBS([bind],[socket]) AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack]) AC_SEARCH_LIBS([strlcpy], [bsd]) @@ -3043,6 +3045,8 @@ AC_CHECK_FUNCS(\ regcomp \ regexec \ regfree \ + res_init \ + __res_init \ rint \ sbrk \ sched_getaffinity \ @@ -3309,6 +3313,9 @@ SQUID_CHECK_RECV_ARG_TYPE SQUID_CHECK_NEED_SYS_ERRLIST SQUID_CHECK_MAXPATHLEN +SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK +SQUID_CHECK_RESOLVER_FIELDS + if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then SQUID_CHECK_WORKING_STATVFS fi