summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-06-16 17:14:53 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-06-30 14:07:37 -0400
commit5c0352f491b46a93a90f82da4c995a36ef5961c9 (patch)
tree93a0ad01bb186d006786e68b4438238ac02d78ce /src
parent604c27c21d6488066c398fbce3e1f57a0847fd78 (diff)
downloadsssd-5c0352f491b46a93a90f82da4c995a36ef5961c9.tar.gz
sssd-5c0352f491b46a93a90f82da4c995a36ef5961c9.tar.xz
sssd-5c0352f491b46a93a90f82da4c995a36ef5961c9.zip
Provide TTL structure names for c-ares < 1.7
https://fedorahosted.org/sssd/ticket/898 In c-ares 1.7, the upstream renamed the addrttl/addr6ttl structures to ares_addrttl/ares_addr6ttl so they are in the ares_ namespace. Because they are committed to stable ABI, the contents are the same, just the name changed -- so it is safe to just #define the new name for older c-ares version in case the new one is not detected in configure time.
Diffstat (limited to 'src')
-rw-r--r--src/external/libcares.m43
-rw-r--r--src/resolv/async_resolv.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/external/libcares.m4 b/src/external/libcares.m4
index 657deac59..5b8a35875 100644
--- a/src/external/libcares.m4
+++ b/src/external/libcares.m4
@@ -18,3 +18,6 @@ AC_CHECK_LIB([cares],
)
AM_CONDITIONAL(BUILD_ARES_DATA, test x$ares_data = x1)
+
+dnl Check if this particular version of c-ares support the new TTL structures
+AC_CHECK_TYPES([struct ares_addrttl, struct ares_addr6ttl], [], [], [#include <ares.h>])
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c
index c05628a35..1f8056722 100644
--- a/src/resolv/async_resolv.c
+++ b/src/resolv/async_resolv.c
@@ -53,6 +53,14 @@
_ares_malloc_data(data)
#endif /* HAVE_ARES_DATA */
+#ifndef HAVE_STRUCT_ARES_ADDRTTL
+#define ares_addrttl addrttl
+#endif
+
+#ifndef HAVE_STRUCT_ARES_ADDR6TTL
+#define ares_addr6ttl addr6ttl
+#endif
+
#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)