NetBSD Problem Report #35254

From www@NetBSD.org  Thu Dec 14 07:27:11 2006
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id 6C10D63BA6D; Thu, 14 Dec 2006 07:27:11 +0000 (UTC)
Message-Id: <20061214072711.6C10D63BA6D@narn.NetBSD.org>
Date: Thu, 14 Dec 2006 07:27:11 +0000 (UTC)
From: arto@selonen.org
Reply-To: arto@selonen.org
To: gnats-bugs@NetBSD.org
Subject: telnet (and others?) provide false/misleading/useless error message for name resolution failure
X-Send-Pr-Version: www-1.0

>Number:         35254
>Category:       misc
>Synopsis:       telnet (and others?) provide false/misleading/useless error message for name resolution failure
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 14 07:30:00 +0000 2006
>Last-Modified:  Wed Dec 20 21:45:02 +0000 2006
>Originator:     Arto Selonen
>Release:        NetBSD-current 4.99.4 from ~20061128
>Organization:
>Environment:
NetBSD blah 4.99.4 NetBSD 4.99.4 (BLAH) #3: Tue Nov 28 11:30:23 EET 2006  blah@blah:/obj/sys/arch/i386/compile/BLAH i386

>Description:
% host www.aka.fi
www.aka.fi is an alias for aka_www.aka.fi.
aka_www.aka.fi has address 193.167.96.169
www.aka.fi is an alias for aka_www.aka.fi.
www.aka.fi is an alias for aka_www.aka.fi.

% telnet www.aka.fi 80
www.aka.fi: Non-recoverable failure in name resolution
Exit 1

The latter command produces an error message which is in disagreement with the result of the first command. Obviously, www.aka.fi could be resolved to IP address 193.167.96.169, so the error message given for the failure indicates at least one of the following:

1) telnet uses different means of resolving, and that fails
2) telnet does not try hard enough and fails where others succeed
3) telnet provides a false error message
4) telnet provides a misleading error message
5) telnet provides somewhat useless error message as the user has no
   means of fixing the problem (www.aka.fi is a valid string)
6) the problem is not in name resolution
7) one can recover from the problem

I guess this comes from the underscore, which is an invalid character for a host name, but valid for DNS. I hope this is not a standards issue, so that the error message for the seemingly useless failure could be fixed to provide more useful and correct information. If the problem is indeed the underscore, then the error message could read eg.

"While resolving www.aka.fi, an invalid character was observed in aka_www.aka.fi; no further attempts will be made"

Since that would lead a more educated user to try host(1) or something similar, and then succeed, the user would still be left in bewilderment as to why telnet(1) can't do what host(1) can. But at least the user would then know what is wrong, even if host name requirements were not known to the user. And, the user would then have the option of trying the IP address instead of the original name, and in some cases that would be sufficient.

Proper error messages make it possible to recover from non-recoverable failures!
>How-To-Repeat:
At the moment, aka.fi still has the above entry, so simply repeating the commands given above should be enough. If the problem comes from the underscore, then one could produce similar DNS entries (as provided in the full description) and then use those names.

If aka.fi is fixed, and the problem is not related to underscore in host name, then I don't know any other ways to produce the problem, yet.
>Fix:
Change/update/augment the error message produced by telnet(1) in the above situation to a useful/correct one.

>Audit-Trail:
From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: gnats-bugs@NetBSD.org
Cc: misc-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: misc/35254: telnet (and others?) provide false/misleading/useless 
 error message for name resolution failure
Date: Fri, 15 Dec 2006 17:46:54 +0100

 This is a multipart MIME message.

 --==_Exmh_13383797826540
 Content-Type: text/plain; charset=us-ascii


 It is not just telnet, it is probably everything which
 uses the libc internal resolver.
 Try eg "getent hosts www.aka.fi".

 I didn't check which characters are allowed at which
 position, so the appended patch is likely nonsense,
 but it shows where the behaviour originates.

 best regards
 Matthias



 --==_Exmh_13383797826540
 Content-Type: text/plain ; name="res.txt"; charset=us-ascii
 Content-Description: res.txt
 Content-Disposition: attachment; filename="res.txt"

 --- res_comp.c.~1.6.~	Mon May 24 11:38:02 2004
 +++ res_comp.c	Fri Dec 15 17:31:13 2006
 @@ -160,7 +160,7 @@ dn_skipname(const u_char *ptr, const u_c
   * is not careful about this, but for some reason, we're doing it right here.
   */
  #define PERIOD 0x2e
 -#define	hyphenchar(c) ((c) == 0x2d)
 +#define	hyphenchar(c) ((c) == 0x2d || (c) == 0x5f)
  #define bslashchar(c) ((c) == 0x5c)
  #define periodchar(c) ((c) == PERIOD)
  #define asterchar(c) ((c) == 0x2a)

 --==_Exmh_13383797826540--

From: Takahiro Kambe <taca@back-street.net>
To: M.Drochner@fz-juelich.de
Cc: gnats-bugs@NetBSD.org
Subject: Re: misc/35254: telnet (and others?) provide
 false/misleading/useless error message for name resolution failure
Date: Mon, 18 Dec 2006 11:55:42 +0900 (JST)

 In message <200612151646.RAA0000090650@zel459.zel.kfa-juelich.de>
 	on Fri, 15 Dec 2006 17:46:54 +0100,
 	Matthias Drochner <M.Drochner@fz-juelich.de> wrote:
 > I didn't check which characters are allowed at which
 > position, so the appended patch is likely nonsense,
 > but it shows where the behaviour originates.
 AFAIR, hostname; A or AAAA record dosen't allow '_' in leaf label.
 BIND 9 (may be also BIND 8) refuse to load such a record in primary
 zone files.

 So, nothing is wrong but www.aka.fi's DNS.

 -- 
 Takahiro Kambe <taca@back-street.net>

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: gnats-bugs@NetBSD.org
Cc: taca@back-street.net, misc-bug-people@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org, arto@selonen.org
Subject: Re: misc/35254: telnet (and others?) provide false/misleading/useless 
 error message for name resolution failure
Date: Tue, 19 Dec 2006 17:53:15 +0100

 taca@back-street.net said:
 >  AFAIR, hostname; A or AAAA record dosen't allow '_' in leaf label. 

 Generally yes -- RFC1123 allows only alphanumeric and hyphen chars.
 Tolerating the "_" would be in the spirit of "be liberal in what
 you accept".
 In the world out there, there are DNS entries like www.aka.fi's,
 and there are operating systems like Linux and Solaris which
 don't complain about it. (Google told me that also Windows
 allows it, but I did check only the former two myself.)

 Newer versions of the resolver lib which comes with BIND support
 an option "no-check-names" to switch off the strict check
 for characters in hostnames. The parsing code is already there,
 just NetBSD's nss glue code was not updated. This is trivial to
 pull in -- I'll post patches to tech-userlevel.
 Allowing each administrator to decide for himself looks like
 a reasonable compromise to me.

 best regards
 Matthias

From: Christian Hattemer <c.hattemer@arcor.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: misc/35254: telnet (and others?) provide false/misleading/useless
 error message for name resolution failure
Date: Wed, 20 Dec 2006 22:42:38 +0100

 Hi,

 thanks for filing this PR.

 I also was puzzled by exactly this issue (on a different domain, however) 
 the other day. I forgot to file it myself since I was too busy.

 The no-check-names option sounds interesting. What would be the default 
 value of it?

 But would you please still look into making a more descriptive error message 
 for the case when the option is off? And once this is done please also save 
 the netbsd-4 user's time by making a pullup.

 -- 
 Bye, Chris

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.