1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-09-11 12:10:50 +03:00

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

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