arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1296031-2.patch

147e83
commit 6b142b3a1d007d7e6f50c26710de7177bc4aca74
147e83
Author: Andreas Schwab <schwab@suse.de>
147e83
Date:   Mon Jun 8 15:21:18 2015 +0200
147e83
147e83
    Record TTL also for DNS PTR queries (bug 18513)
147e83
    
147e83
    This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.
147e83
147e83
2015-06-22  Andreas Schwab  <schwab@suse.de>
147e83
147e83
	[BZ #18513]
147e83
	* resolv/nss_dns/dns-host.c (getanswer_r): Record TTL also for
147e83
	PTR queries.
147e83
147e83
Index: glibc-2.17-c758a686/resolv/nss_dns/dns-host.c
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/resolv/nss_dns/dns-host.c
147e83
+++ glibc-2.17-c758a686/resolv/nss_dns/dns-host.c
147e83
@@ -800,6 +800,10 @@ getanswer_r (const querybuf *answer, int
147e83
 
147e83
       if (qtype == T_PTR && type == T_CNAME)
147e83
 	{
147e83
+	  /* A CNAME could also have a TTL entry.  */
147e83
+	  if (ttlp != NULL && ttl < *ttlp)
147e83
+	      *ttlp = ttl;
147e83
+
147e83
 	  n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
147e83
 	  if (__builtin_expect (n < 0 || res_dnok (tbuf) == 0, 0))
147e83
 	    {
147e83
@@ -863,6 +867,8 @@ getanswer_r (const querybuf *answer, int
147e83
 	      ++had_error;
147e83
 	      break;
147e83
 	    }
147e83
+	  if (ttlp != NULL && ttl < *ttlp)
147e83
+	      *ttlp = ttl;
147e83
 #if MULTI_PTRS_ARE_ALIASES
147e83
 	  cp += n;
147e83
 	  if (haveanswer == 0)