Record TTL also for DNS PTR queries (bug 18513)

This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.
This commit is contained in:
Andreas Schwab 2015-06-08 15:21:18 +02:00
parent ef635a29f7
commit 6b142b3a1d
3 changed files with 15 additions and 3 deletions

View File

@ -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.

6
NEWS
View File

@ -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.

View File

@ -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;