Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2001 00:42:17 +0000
From:      Tony Finch <dot@dotat.at>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/30496: `host` does not work properly with top-level domains
Message-ID:  <E15gbd3-0000m6-00@hand.dotat.at>

next in thread | raw e-mail | index | archive | help

>Number:         30496
>Category:       bin
>Synopsis:       `host` does not work properly with top-level domains
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 10 16:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Tony Finch
>Release:        FreeBSD 4.4-RC i386
>Organization:
dotat labs
>Environment:
System: FreeBSD hand.dotat.at 4.4-RC FreeBSD 4.4-RC #4: Sat Sep 1 19:06:27 GMT 2001 fanf@hand.dotat.at:/FreeBSD/obj/FreeBSD/releng4/sys/SHARP i386

>Description:

`host` fails to make queries for top-level domains properly, because it
adds a superfluous dot to the end of the domain name when constructing
the query.

>How-To-Repeat:

fanf@hand.dotat.at:/FreeBSD/releng4/contrib/bind/bin/host
:; cat /etc/resolv.conf
search lab.dotat.at. dotat.at. .
nameserver 127.0.0.1
fanf@hand.dotat.at:~
:; /usr/obj/FreeBSD/releng4/usr.bin/host/host -d -v -t soa uk
Trying domain "lab.dotat.at."
;; res_nmkquery(QUERY, uk.lab.dotat.at., IN, SOA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31536
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;;      uk.lab.dotat.at, type = SOA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 31536
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;;      uk.lab.dotat.at, type = SOA, class = IN
lab.dotat.at.           1H IN SOA       hand.dotat.at. dot.dotat.at. (
                                        999950951       ; serial
                                        1D              ; refresh
                                        5M              ; retry
                                        1W              ; expiry
                                        1H )            ; minimum
rcode = 3 (Non-existent domain), ancount=0
Trying domain "dotat.at."
;; res_nmkquery(QUERY, uk.dotat.at., IN, SOA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31537
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;;      uk.dotat.at, type = SOA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 31537
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;;      uk.dotat.at, type = SOA, class = IN
dotat.at.               1H IN SOA       chiark.greenend.org.uk. dot.dotat.at. (
                                        999303549       ; serial
                                        1D              ; refresh
                                        5M              ; retry
                                        1W              ; expiry
                                        1H )            ; minimum
rcode = 3 (Non-existent domain), ancount=0
Trying domain "."
;; res_nmkquery(QUERY, uk.., IN, SOA)
res_nmkquery failed
No recovery, Host not found.
fanf@hand.dotat.at:~
:;

>Fix:

Index: host.c
===================================================================
RCS file: /home/ncvs/src/contrib/bind/bin/host/host.c,v
retrieving revision 1.1.1.2.2.4
diff -u -r1.1.1.2.2.4 host.c
--- host.c	2001/08/05 16:02:05	1.1.1.2.2.4
+++ host.c	2001/09/03 00:07:04
@@ -611,7 +611,8 @@
 	int n;
 	char host[NS_MAXDNAME];
 
-	if (domain == NULL)
+	if (domain == NULL ||
+	    domain[0] == '.' && domain[1] == '\0')
 		sprintf(host, "%.*s", NS_MAXDNAME, name);
 	else
 		sprintf(host, "%.*s.%.*s",
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E15gbd3-0000m6-00>