Blame SOURCES/glibc-rh808545.patch

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