summaryrefslogtreecommitdiffstats
path: root/src/providers/data_provider_fo.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-06-10 14:01:17 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-07-13 12:35:45 -0400
commit90f150f678347f1f73ee4280cd523021e307d861 (patch)
treefe93aa07c20d98522fd0c359f50c69b7519f49e0 /src/providers/data_provider_fo.c
parent401bfa7e4f8c2ed555576576881a2bd9622c1e2e (diff)
downloadsssd-90f150f678347f1f73ee4280cd523021e307d861.tar.gz
sssd-90f150f678347f1f73ee4280cd523021e307d861.tar.xz
sssd-90f150f678347f1f73ee4280cd523021e307d861.zip
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.
Diffstat (limited to 'src/providers/data_provider_fo.c')
-rw-r--r--src/providers/data_provider_fo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index f1e1e137c..58468c820 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -453,14 +453,15 @@ static void be_resolve_server_done(struct tevent_req *subreq)
/* all fine we got the server */
if (debug_level >= 4) {
- struct hostent *srvaddr;
+ struct resolv_hostent *srvaddr;
char ipaddr[128];
srvaddr = fo_get_server_hostent(state->srv);
- inet_ntop(srvaddr->h_addrtype, srvaddr->h_addr_list[0],
+ inet_ntop(srvaddr->family, srvaddr->addr_list[0]->ipaddr,
ipaddr, 128);
- DEBUG(4, ("Found address for server %s: [%s]\n",
- fo_get_server_name(state->srv), ipaddr));
+ DEBUG(4, ("Found address for server %s: [%s] TTL %d\n",
+ fo_get_server_name(state->srv), ipaddr,
+ srvaddr->addr_list[0]->ttl));
}
srv_status_change = fo_get_server_hostname_last_change(state->srv);