aboutsummaryrefslogtreecommitdiff
path: root/resolv/nss_dns
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2015-06-08 15:21:18 +0200
committerAndreas Schwab <schwab@suse.de>2015-06-22 14:04:34 +0200
commit6b142b3a1d007d7e6f50c26710de7177bc4aca74 (patch)
treefda4f1391070325d88cdc7bdcef1b6a34dc94304 /resolv/nss_dns
parentef635a29f7123f25ee0600b7a6aca1c511c63e85 (diff)
downloadglibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.zip
glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.gz
glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.bz2
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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index d8c5579..357ac04 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;