File dns-ptr-ttl.patch of Package glibc.1873
2015-06-22 Andreas Schwab <schwab@suse.de>
[BZ #18513]
* resolv/nss_dns/dns-host.c (getanswer_r): Record TTL also for
PTR queries.
Index: glibc-2.19/resolv/nss_dns/dns-host.c
===================================================================
--- glibc-2.19.orig/resolv/nss_dns/dns-host.c
+++ glibc-2.19/resolv/nss_dns/dns-host.c
@@ -802,6 +802,10 @@ getanswer_r (const querybuf *answer, int
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 (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
{
@@ -872,6 +876,8 @@ getanswer_r (const querybuf *answer, int
++had_error;
break;
}
+ if (ttlp != NULL && ttl < *ttlp)
+ *ttlp = ttl;
#if MULTI_PTRS_ARE_ALIASES
cp += n;
if (haveanswer == 0)