Blame SOURCES/glibc-rh808545.patch

b9ba6d
diff -rup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
b9ba6d
--- a/resolv/nss_dns/dns-host.c	2012-04-18 11:17:31.527539744 -0600
b9ba6d
+++ b/resolv/nss_dns/dns-host.c	2012-04-18 11:21:45.441394159 -0600
b9ba6d
@@ -745,6 +745,10 @@ getanswer_r (const querybuf *answer, int
b9ba6d
 
b9ba6d
       if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME)
b9ba6d
 	{
b9ba6d
+	  /* A CNAME could also have a TTL entry.  */
b9ba6d
+	  if (ttlp != NULL && ttl < *ttlp)
b9ba6d
+	      *ttlp = ttl;
b9ba6d
+
b9ba6d
 	  if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1])
b9ba6d
 	    continue;
b9ba6d
 	  n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
b9ba6d
@@ -906,7 +910,7 @@ getanswer_r (const querybuf *answer, int
b9ba6d
 	    {
b9ba6d
 	      register int nn;
b9ba6d
 
b9ba6d
-	      if (ttlp != NULL)
b9ba6d
+	      if (ttlp != NULL && ttl < *ttlp)
b9ba6d
 		*ttlp = ttl;
b9ba6d
 	      if (canonp != NULL)
b9ba6d
 		*canonp = bp;
b9ba6d
@@ -1082,6 +1086,11 @@ gaih_getanswer_slice (const querybuf *an
b9ba6d
       if (type == T_CNAME)
b9ba6d
 	{
b9ba6d
 	  char tbuf[MAXDNAME];
b9ba6d
+
b9ba6d
+	  /* A CNAME could also have a TTL entry.  */
b9ba6d
+	  if (ttlp != NULL && ttl < *ttlp)
b9ba6d
+	    *ttlp = ttl;
b9ba6d
+
b9ba6d
 	  n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf);
b9ba6d
 	  if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0))
b9ba6d
 	    {
b9ba6d
@@ -1162,7 +1171,7 @@ gaih_getanswer_slice (const querybuf *an
b9ba6d
 
b9ba6d
       if (*firstp)
b9ba6d
 	{
b9ba6d
-	  if (ttlp != NULL)
b9ba6d
+	  if (ttlp != NULL && ttl < *ttlp)
b9ba6d
 	    *ttlp = ttl;
b9ba6d
 
b9ba6d
 	  (*pat)->name = canon ?: h_name;