From owner-freebsd-hackers Thu May 2 13:17:31 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id NAA22611 for hackers-outgoing; Thu, 2 May 1996 13:17:31 -0700 (PDT) Received: from irbs.irbs.com (irbs.com [199.182.75.129]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id NAA22590 Thu, 2 May 1996 13:17:24 -0700 (PDT) Received: (from jc@localhost) by irbs.irbs.com (8.7.5/8.6.6) id QAA24130; Thu, 2 May 1996 16:14:31 -0400 (EDT) From: John Capo Message-Id: <199605022014.QAA24130@irbs.irbs.com> Subject: Re: Named and Reverse DNS lookups [PATCH] To: jgreco@brasil.moneng.mei.com (Joe Greco) Date: Thu, 2 May 1996 16:14:31 -0400 (EDT) Cc: jdp@polstra.com, jgreco@brasil.moneng.mei.com, nate@sri.MT.net, hackers@freebsd.org, freebsd-isp@freebsd.org In-Reply-To: <199605021304.IAA11378@brasil.moneng.mei.com> from Joe Greco at "May 2, 96 08:04:24 am" X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Joe Greco writes: > > I had reason to play with it around the time 2.1R came out, I couldn't get > it to work, and someone on either the BIND list or the domains newsgroup > confirmed that the BIND in FreeBSD did not support it. > > I would be delighted to be proven wrong, of course, because we need things > like this. > The resolver is broken, not BIND. :-( I've been screwing with this since yesterday thinking it was a DNS configuration problem. nslookup and dig worked fine but anything that used the libc resolver did not work right. Too close to the forest I guess. Anyway, 1.1.5.1 handles delegated in-addr fine as does Sun0S 4.1.3. goombay.irbs.com has its in-addr delegated. Traceroute to it from a 2.1 system and you will probably see this on the console: gethostby*.gethostanswer: asked for "132.75.182.199.in-addr.arpa",\ got "132.128.75.182.199.in-addr.arpa" Patch taken from BIND-4.9.3P1 follows. John Capo jc@irbs.com IRBS Engineering FreeBSD Servers and Workstations (954) 792-9551 Unix/Internet Consulting - ISP Solutions *** /usr/stable/src/lib/libc/net/gethostbydns.c Tue Apr 30 22:21:09 1996 --- lib/libc/net/gethostbydns.c Thu May 2 15:57:38 1996 *************** *** 186,192 **** --- 186,194 ---- int haveanswer, had_error; int toobig = 0; char tbuf[MAXDNAME+1]; + const char *tname; + tname = qname; host.h_name = NULL; eom = answer->buf + anslen; /* *************** *** 277,282 **** --- 279,303 ---- buflen -= n; continue; } + if (qtype == T_PTR && type == T_CNAME) { + n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf); + if (n < 0) { + had_error++; + continue; + } + cp += n; + /* Get canonical name. */ + n = strlen(tbuf) + 1; /* for the \0 */ + if (n > buflen) { + had_error++; + continue; + } + strcpy(bp, tbuf); + tname = bp; + bp += n; + buflen -= n; + continue; + } if (type != qtype) { /* CNAME->PTR should not cause a log message. */ if (!(qtype == T_PTR && type == T_CNAME)) *************** *** 289,295 **** } switch (type) { case T_PTR: ! if (strcasecmp(qname, bp) != 0) { syslog(LOG_NOTICE|LOG_AUTH, AskedForGot, qname, bp); cp += n; --- 310,316 ---- } switch (type) { case T_PTR: ! if (strcasecmp(tname, bp) != 0) { syslog(LOG_NOTICE|LOG_AUTH, AskedForGot, qname, bp); cp += n;