From owner-freebsd-stable Thu Sep 21 17:39:54 2000 Delivered-To: freebsd-stable@freebsd.org Received: from static.unixfreak.org (static.unixfreak.org [63.198.170.139]) by hub.freebsd.org (Postfix) with ESMTP id 29BF837B440; Thu, 21 Sep 2000 17:39:46 -0700 (PDT) Received: by static.unixfreak.org (Postfix, from userid 1000) id 5BC6E1F27; Thu, 21 Sep 2000 17:14:56 -0700 (PDT) Subject: Re: 'host' command with CNAMEs In-Reply-To: from Tim Zingelman at "Sep 21, 2000 10:32:59 am" To: Tim Zingelman Date: Thu, 21 Sep 2000 17:14:56 -0700 (PDT) Cc: stable@FreeBSD.ORG, current@FreeBSD.ORG From: Dima Dorfman Reply-To: dima@unixfreak.org X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM969581696-60857-0_ Content-Transfer-Encoding: 7bit Message-Id: <20000922001456.5BC6E1F27@static.unixfreak.org> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --ELM969581696-60857-0_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > > As I recall, Sean Kelly wrote: > > > I've got two machines here, one running 4.1-STABLE (from Aug 3) and a > > > 5.0-CURRENT (from Aug 10) and both of them show the same issue. When > > > you use the 'host' command to resolve a CNAME, it will show all the A > > > records twice: > > > > > > (7) smkelly@edgemaster:~$ host www.microsoft.com > > > www.microsoft.com is a nickname for microsoft.com > > > microsoft.com has address 207.46.130.45 > > > microsoft.com has address 207.46.230.218 > > > microsoft.com has address 207.46.230.219 > > > microsoft.com has address 207.46.230.218 > > > microsoft.com has address 207.46.230.219 > > > microsoft.com has address 207.46.130.45 > > It is more complicated than that... the bug only shows up if you specify > an alias name... You are both correct. In fact, it looks like you're stating the exact same thing. The obvious problem is that if 'host' is resolving a CNAME, there are two independant places which display the real address. My guess is that at some point, two independant developers decided to change the way 'host' deals with CNAMEs, but they put their code in different places. When they commited their code to the CVS repository, there were no conflicts, and the second one to commit failed to notice that a part of his code was already implemented. This bug was actually fixed in rev. 8.28 of host.c (BIND v8.2.1), but was resurrected in rev. 8.31 (BIND v8.2.2-REL). Since ISC doesn't release their CVS logs to the public, I can't find out why this was done (perhaps a developer commited something based on an earlier rev., and didn't merge this change). If anybody wants it, I've made a patch to correct the problem (see attached). It applies against src/contrib/bind/bin/host/host.c of 5-CURRENT (although host.c is the same in RELENG_4, and it applies cleanly there). I heard somewhere that the contrib/ tree shouldn't contain local changes, but I'm unclear as to where local changes to contribited software go, so I made it against that. Once you've applied it, all you should have to do is `( cd /usr/src/usr.bin/host && make)`, although I haven't tested that approach. This should also apply cleanly to host.c of BIND 8.2.3-T5B, as that's what is in FreeBSD. Hope this helps -- Dima Dorfman Finger dima@unixfreak.org for my public PGP key. "When in doubt, use brute force." -- Ken Thompson --ELM969581696-60857-0_ Content-Type: text/plain; charset=US-ASCII Content-Disposition: attachment; filename=host-cname.diff Content-Description: /usr/home/dima/host-cname.diff Content-Transfer-Encoding: 7bit Index: host.c =================================================================== RCS file: /usr/cvs/FreeBSD/src/contrib/bind/bin/host/host.c,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 host.c --- host.c 2000/05/26 07:17:07 1.1.1.3 +++ host.c 2000/09/21 23:46:26 @@ -696,8 +696,18 @@ if (!hp->ad) if (verbose && isls == 0) printf("The following answer is not verified as authentic by the server:\n"); - while (--ancount >= 0 && cp && cp < eom) + while (--ancount >= 0 && cp && cp < eom) { cp = pr_rr(cp, answer->qb2, stdout, filter); + /* + * When we ask for address and there is a CNAME, it + * seems to return both the CNAME and the address. + * Since we trace down the CNAME chain ourselves, we + * don't really want to print the address at this + * point. + */ + if (cname && ! verbose) + return (1); + } } if (!verbose) return (1); --ELM969581696-60857-0_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message