From dmitry@atlantis.dp.ua  Wed Aug 21 03:26:51 2002
Return-Path: <dmitry@atlantis.dp.ua>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A088B37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 Aug 2002 03:26:51 -0700 (PDT)
Received: from atlantis.atlantis.dp.ua (atlantis.atlantis.dp.ua [193.108.46.1])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 489D943E6E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 Aug 2002 03:26:49 -0700 (PDT)
	(envelope-from dmitry@atlantis.dp.ua)
Received: from atlantis.atlantis.dp.ua (localhost [127.0.0.1])
	by atlantis.atlantis.dp.ua (8.12.3/8.12.3) with ESMTP id g7LAQZtp027011
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 21 Aug 2002 13:26:36 +0300 (EEST)
	(envelope-from dmitry@atlantis.dp.ua)
Received: (from dmitry@localhost)
	by atlantis.atlantis.dp.ua (8.12.3/8.12.3/Submit) id g7LAQXQl027002;
	Wed, 21 Aug 2002 13:26:33 +0300 (EEST)
Message-Id: <200208211026.g7LAQXQl027002@atlantis.atlantis.dp.ua>
Date: Wed, 21 Aug 2002 13:26:33 +0300 (EEST)
From: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Reply-To: Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: telnet client can't resolve hostname in -s option
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41841
>Category:       bin
>Synopsis:       telnet client can't resolve hostname in -s option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 21 03:30:01 PDT 2002
>Closed-Date:    Tue Oct 01 17:27:32 PDT 2002
>Last-Modified:  Tue Oct 01 17:27:32 PDT 2002
>Originator:     Dmitry Pryanishnikov
>Release:        FreeBSD 4.6-RELEASE-p1 i386
>Organization:
Atlantis ISP
>Environment:
>Description:
	Telnet client can't resolve host name given with -s option:
	"telnet -s host" doesn't work while "telnet -s IP" works.
>How-To-Repeat:
	
	dmitry@atlantis$ telnet localhost
	Trying 127.0.0.1...
	telnet: connect to address 127.0.0.1: Connection refused
	telnet: Unable to connect to remote host

	So "localhost" resolves OK...

	dmitry@atlantis$ telnet -s localhost localhost
	localhost: hostname nor servname provided, or not known

	...except in -s option!

	dmitry@atlantis$ telnet -s 127.0.0.1 localhost
	Trying 127.0.0.1...
	telnet: connect to address 127.0.0.1: Connection refused
	telnet: Unable to connect to remote host

	-s IP still works.
>Fix:
	Don't know.
>Release-Note:
>Audit-Trail:

From: Maxim Maximov <mcsi@agava.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/41841: telnet client can't resolve hostname in -s option
Date: Wed, 21 Aug 2002 14:54:07 +0400

  From src/usr.bin/telnet/command.c:
 
      if (src_addr != NULL) {
          memset(&hints, 0, sizeof(hints));
          hints.ai_flags = AI_NUMERICHOST;
          hints.ai_family = family;
          hints.ai_socktype = SOCK_STREAM;
          error = getaddrinfo(src_addr, 0, &hints, &src_res);
 
 note "hints.ai_flags = AI_NUMERICHOST". it states, that "a non-NULL 
 nodename string must be a numeric host address string." (excerpt from 
 getaddrinfo(3))
 
 so either manpage lies, or one should remove this string from commands.c
 
 Dmitry Pryanishnikov wrote:
 >>Number:         41841
 >>Category:       bin
 >>Synopsis:       telnet client can't resolve hostname in -s option
 >>Confidential:   no
 >>Severity:       serious
 >>Priority:       medium
 >>Responsible:    freebsd-bugs
 >>State:          open
 >>Quarter:        
 >>Keywords:       
 >>Date-Required:
 >>Class:          sw-bug
 >>Submitter-Id:   current-users
 >>Arrival-Date:   Wed Aug 21 03:30:01 PDT 2002
 >>Closed-Date:
 >>Last-Modified:
 >>Originator:     Dmitry Pryanishnikov
 >>Release:        FreeBSD 4.6-RELEASE-p1 i386
 >>Organization:
 > 
 > Atlantis ISP
 > 
 >>Environment:
 >>Description:
 > 
 > 	Telnet client can't resolve host name given with -s option:
 > 	"telnet -s host" doesn't work while "telnet -s IP" works.
 > 
 >>How-To-Repeat:
 > 
 > 	
 > 	dmitry@atlantis$ telnet localhost
 > 	Trying 127.0.0.1...
 > 	telnet: connect to address 127.0.0.1: Connection refused
 > 	telnet: Unable to connect to remote host
 > 
 > 	So "localhost" resolves OK...
 > 
 > 	dmitry@atlantis$ telnet -s localhost localhost
 > 	localhost: hostname nor servname provided, or not known
 > 
 > 	...except in -s option!
 > 
 > 	dmitry@atlantis$ telnet -s 127.0.0.1 localhost
 > 	Trying 127.0.0.1...
 > 	telnet: connect to address 127.0.0.1: Connection refused
 > 	telnet: Unable to connect to remote host
 > 
 > 	-s IP still works.
 > 
 >>Fix:
 > 
 > 	Don't know.
 > 
 >>Release-Note:
 >>Audit-Trail:
 >>Unformatted:
 > 
 >  >System: FreeBSD atlantis.atlantis.dp.ua 4.6-RELEASE-p1 FreeBSD 4.6-RELEASE-p1 #0: Sat Jul 6 17:31:08 EEST 2002 root@atlantis.dp.ua:/usr/src/sys/compile/ATLANTIS i386
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 
 
 -- 
 Maxim Maximov
 System Administrator
 AGAVA Software (http://www.agava.com)
 

From: dmitry@atlantis.dp.ua
To: freebsd-gnats-submit@FreeBSD.org, dmitry@atlantis.dp.ua
Cc:  
Subject: Re: bin/41841: telnet client can't resolve hostname in
Date: Fri, 23 Aug 2002 12:05:12 +0300 (EEST)

 Hello!
 
 Maxim Maximov <mcsi@agava.com> wrote:
 > so either manpage lies, or one should remove this string from commands.c
 
  Yes, the following patch:
 
 --- commands.c.orig     Sat Apr 13 14:07:13 2002
 +++ commands.c  Fri Aug 23 08:56:26 2002
 @@ -1980,7 +1980,6 @@
      if (src_addr != NULL) {
         memset(&hints, 0, sizeof(hints));
 -       hints.ai_flags = AI_NUMERICHOST;
         hints.ai_family = family;
         hints.ai_socktype = SOCK_STREAM;
         error = getaddrinfo(src_addr, 0, &hints, &src_res);
 
 fixes the problem in 4.6.2-RELEASE (commands.c version 1.21.2.5).
 Please commit this trivial fix!
 
State-Changed-From-To: open->closed 
State-Changed-By: dd 
State-Changed-When: Tue Oct 1 17:27:17 PDT 2002 
State-Changed-Why:  
Fixed in -current.  I'll MFC after 4.7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41841 
>Unformatted:
 >System: FreeBSD atlantis.atlantis.dp.ua 4.6-RELEASE-p1 FreeBSD 4.6-RELEASE-p1 #0: Sat Jul 6 17:31:08 EEST 2002 root@atlantis.dp.ua:/usr/src/sys/compile/ATLANTIS i386
