From 90f150f678347f1f73ee4280cd523021e307d861 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 10 Jun 2011 14:01:17 +0200 Subject: Honor the TTL value of SRV record lookups Add new resolv_hostent data structure and utility functions Resolve hosts by name from files into resolv_hostent Resolve hosts by name from DNS into resolv_hostent Switch resolver to using resolv_hostent and honor TTL Conflicts: src/providers/fail_over.c 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. --- src/tests/fail_over-tests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tests/fail_over-tests.c') diff --git a/src/tests/fail_over-tests.c b/src/tests/fail_over-tests.c index a96549dc..84016dd9 100644 --- a/src/tests/fail_over-tests.c +++ b/src/tests/fail_over-tests.c @@ -147,7 +147,7 @@ test_resolve_service_callback(struct tevent_req *req) int port; struct task *task; struct fo_server *server = NULL; - struct hostent *he; + struct resolv_hostent *he; int i; task = tevent_req_callback_data(req, struct task); @@ -172,10 +172,10 @@ test_resolve_service_callback(struct tevent_req *req) he = fo_get_server_hostent(server); fail_if(he == NULL, "%s: fo_get_server_hostent() returned NULL"); - for (i = 0; he->h_addr_list[i]; i++) { + for (i = 0; he->addr_list[i]; i++) { char buf[256]; - inet_ntop(he->h_addrtype, he->h_addr_list[i], buf, sizeof(buf)); + inet_ntop(he->family, he->addr_list[i]->ipaddr, buf, sizeof(buf)); fail_if(strcmp(buf, "127.0.0.1") != 0 && strcmp(buf, "::1") != 0); } -- cgit