]>
Commit | Line | Data |
---|---|---|
12788f63 MT |
1 | diff -rup a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c |
2 | --- a/resolv/nss_dns/dns-host.c 2012-04-18 11:17:31.527539744 -0600 | |
3 | +++ b/resolv/nss_dns/dns-host.c 2012-04-18 11:21:45.441394159 -0600 | |
4 | @@ -745,6 +745,10 @@ getanswer_r (const querybuf *answer, int | |
5 | ||
6 | if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) | |
7 | { | |
8 | + /* A CNAME could also have a TTL entry. */ | |
9 | + if (ttlp != NULL && ttl < *ttlp) | |
10 | + *ttlp = ttl; | |
11 | + | |
12 | if (ap >= &host_data->aliases[MAX_NR_ALIASES - 1]) | |
13 | continue; | |
14 | n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); | |
15 | @@ -906,7 +910,7 @@ getanswer_r (const querybuf *answer, int | |
16 | { | |
17 | register int nn; | |
18 | ||
19 | - if (ttlp != NULL) | |
20 | + if (ttlp != NULL && ttl < *ttlp) | |
21 | *ttlp = ttl; | |
22 | if (canonp != NULL) | |
23 | *canonp = bp; | |
24 | @@ -1082,6 +1086,11 @@ gaih_getanswer_slice (const querybuf *an | |
25 | if (type == T_CNAME) | |
26 | { | |
27 | char tbuf[MAXDNAME]; | |
28 | + | |
29 | + /* A CNAME could also have a TTL entry. */ | |
30 | + if (ttlp != NULL && ttl < *ttlp) | |
31 | + *ttlp = ttl; | |
32 | + | |
33 | n = dn_expand (answer->buf, end_of_message, cp, tbuf, sizeof tbuf); | |
34 | if (__builtin_expect (n < 0 || res_hnok (tbuf) == 0, 0)) | |
35 | { | |
36 | @@ -1162,7 +1171,7 @@ gaih_getanswer_slice (const querybuf *an | |
37 | ||
38 | if (*firstp) | |
39 | { | |
40 | - if (ttlp != NULL) | |
41 | + if (ttlp != NULL && ttl < *ttlp) | |
42 | *ttlp = ttl; | |
43 | ||
44 | (*pat)->name = canon ?: h_name; |