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 | |
parent | ef635a29f7123f25ee0600b7a6aca1c511c63e85 (diff) | |
download | glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.gz glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.tar.xz glibc-6b142b3a1d007d7e6f50c26710de7177bc4aca74.zip |
Record TTL also for DNS PTR queries (bug 18513)
This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | resolv/nss_dns/dns-host.c | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 1150ec5d2e..6442ca66ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-06-22 Andreas Schwab <schwab@suse.de> + + [BZ #18513] + * resolv/nss_dns/dns-host.c (getanswer_r): Record TTL also for + PTR queries. + 2015-06-22 Leonhard Holz <leonhard.holz@web.de> * string/strcoll_l.c (STRCOLL): Remove unnecessary memset. diff --git a/NEWS b/NEWS index 90495e8e87..6f8cb0628d 100644 --- a/NEWS +++ b/NEWS @@ -21,9 +21,9 @@ Version 2.22 18197, 18206, 18210, 18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319, 18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, - 18497, 18498, 18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, - 18530, 18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, - 18546, 18547, 18553, 18558, 18569. + 18497, 18498, 18507, 18512, 18513, 18519, 18520, 18522, 18527, 18528, + 18529, 18530, 18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, + 18545, 18546, 18547, 18553, 18558, 18569. * Cache information can be queried via sysconf() function on s390 e.g. with _SC_LEVEL1_ICACHE_SIZE as argument. 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; |