From: Andreas Schwab <schwab@redhat.com>
To: libc-hacker@sourceware.org
Subject: [PATCH] Don't ignore zero TTL in DNS answers
Date: Wed, 24 Nov 2010 15:05:00 -0000 [thread overview]
Message-ID: <m3lj4i92zl.fsf@redhat.com> (raw)
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.
---
resolv/nss_dns/dns-host.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 19f6dab..9cd2641 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -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))
@@ -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 */
@@ -916,7 +915,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;
@@ -1177,7 +1176,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
++had_error;
continue;
}
- if (ttl != 0 && ttlp != NULL)
+ if (ttlp != NULL)
*ttlp = ttl;
(*pat)->name = canon ?: h_name;
--
1.7.2.3
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
reply other threads:[~2010-11-24 15:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3lj4i92zl.fsf@redhat.com \
--to=schwab@redhat.com \
--cc=libc-hacker@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).