From: wessels <> Date: Tue, 1 Feb 2000 12:15:26 +0000 (+0000) Subject: DW: X-Git-Tag: SQUID_3_0_PRE1~2069 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0017a7216c8149dfda5f0a78de04b0587b8be53;p=thirdparty%2Fsquid.git DW: - fixed byte-order bug for PTR lookups. --- diff --git a/lib/rfc1035.c b/lib/rfc1035.c index 807bd4956f..b0ee511d1b 100644 --- a/lib/rfc1035.c +++ b/lib/rfc1035.c @@ -1,6 +1,6 @@ /* - * $Id: rfc1035.c,v 1.12 2000/01/24 21:57:49 wessels Exp $ + * $Id: rfc1035.c,v 1.13 2000/02/01 05:15:26 wessels Exp $ * * Low level DNS protocol routines * AUTHOR: Duane Wessels @@ -424,7 +424,7 @@ rfc1035AnswersUnpack(const char *buf, } } while (l > 0); /* a zero-length label terminates */ off += 4; /* qtype, qclass */ - assert (off <= sz); + assert(off <= sz); } i = (int) hdr.ancount; if (i == 0) @@ -491,12 +491,12 @@ rfc1035BuildPTRQuery(const struct in_addr addr, char *buf, size_t * szp) static char rev[32]; unsigned int i; memset(&h, '\0', sizeof(h)); - i = (unsigned int) addr.s_addr; - snprintf(rev, 32, "%u.%u.%u.%u.in-addr.arpa", - (i >> 24) & 255, - (i >> 16) & 255, + i = (unsigned int) ntohl(addr.s_addr); + snprintf(rev, 32, "%u.%u.%u.%u.in-addr.arpa.", + i & 255, (i >> 8) & 255, - i & 255); + (i >> 16) & 255, + (i >> 24) & 255); h.id = rfc1035Qid(); h.qr = 0; h.rd = 1;