Skip to content

Commit

Permalink
Don't ignore zero TTL in DNS answers
Browse files Browse the repository at this point in the history
(cherry picked from commit a769081)
  • Loading branch information
Andreas Schwab committed Dec 1, 2010
1 parent c86e42c commit 1489c92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2010-11-24 Andreas Schwab <schwab@redhat.com>

* resolv/nss_dns/dns-host.c (getanswer_r): Don't handle ttl == 0
specially.
(gaih_getanswer_slice): Likewise.

2010-05-31 Petr Baudis <pasky@suse.cz>

[BZ #11149]
Expand Down
7 changes: 3 additions & 4 deletions resolv/nss_dns/dns-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
int (*name_ok) (const char *);
u_char packtmp[NS_MAXCDNAME];
int have_to_map = 0;
int32_t ttl = 0;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
buffer += pad;
if (__builtin_expect (buflen < sizeof (struct host_data) + pad, 0))
Expand Down Expand Up @@ -733,7 +732,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
cp += INT16SZ; /* type */
class = __ns_get16 (cp);
cp += INT16SZ; /* class */
ttl = __ns_get32 (cp);
int32_t ttl = __ns_get32 (cp);
cp += INT32SZ; /* TTL */
n = __ns_get16 (cp);
cp += INT16SZ; /* len */
Expand Down Expand Up @@ -907,7 +906,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
{
register int nn;

if (ttlp != NULL && ttl != 0)
if (ttlp != NULL)
*ttlp = ttl;
if (canonp != NULL)
*canonp = bp;
Expand Down Expand Up @@ -1163,7 +1162,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,

if (*firstp)
{
if (ttl != 0 && ttlp != NULL)
if (ttlp != NULL)
*ttlp = ttl;

(*pat)->name = canon ?: h_name;
Expand Down

0 comments on commit 1489c92

Please sign in to comment.