diff options
author | Andreas Schwab <schwab@suse.de> | 2015-06-08 15:21:18 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2015-06-22 14:04:34 +0200 |
commit | 6b142b3a1d007d7e6f50c26710de7177bc4aca74 (patch) | |
tree | fda4f1391070325d88cdc7bdcef1b6a34dc94304 /resolv/nss_dns | |
parent | ef635a29f7123f25ee0600b7a6aca1c511c63e85 (diff) | |
download | glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.gz glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.bz2 glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.zip |
Record TTL also for DNS PTR queries (bug 18513)
This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.
Diffstat (limited to 'resolv/nss_dns')
-rw-r--r-- | resolv/nss_dns/dns-host.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index d8c5579159..357ac04693 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -800,6 +800,10 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, if (qtype == T_PTR && type == T_CNAME) { + /* A CNAME could also have a TTL entry. */ + if (ttlp != NULL && ttl < *ttlp) + *ttlp = ttl; + n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); if (__glibc_unlikely (n < 0 || res_dnok (tbuf) == 0)) { @@ -863,6 +867,8 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, ++had_error; break; } + if (ttlp != NULL && ttl < *ttlp) + *ttlp = ttl; /* bind would put multiple PTR records as aliases, but we don't do that. */ result->h_name = bp; |