Subject: bin/17440: ssh doesn't work: servname not supported for ai_socktype
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: netbsd-bugs
Date: 06/30/2002 14:16:26
>Number: 17440
>Category: bin
>Synopsis: ssh doesn't work: servname not supported for ai_socktype
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 30 06:17:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Ben Harris
>Release: 1.6_BETA4
>Organization:
>Environment:
NetBSD/acorn32, autobuilt RPC_WSCONS kernel:
NetBSD 1.6_BETA4 (RPC_WSCONS) #0: Sun Jun 30 10:27:36 UTC 2002
autobuild@tgm.daemon.org:/autobuild/acorn32/OBJ/autobuild/src/sys/arch/acorn32/compile/RPC_WSCONS
>Description:
Attempting to make any ssh connection fails with:
ssh: <hostname>: servname not supported for ai_socktype
breakpointing getaddrinfo() shows that ssh is passing a port of "1441814"
which unsurprisingly fails. This is 0x160016, which seems to come about
from a call to snprintf from sshconnect.c::ssh_connect() where a u_short
is used as an argument for a %u format:
ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
u_short port, int family, int connection_attempts,
int needpriv, const char *proxy_command)
{
[...]
snprintf(strport, sizeof strport, "%u", port);
>How-To-Repeat:
southeast-iceland# ssh cvs.netbsd.org
ssh: cvs.netbsd.org: servname not supported for ai_socktype
/etc/ssh/ssh_config contains only comments, ~/.ssh is missing.
nsswitch.conf contains:
group: compat
group_compat: nis
hosts: files dns
netgroup: files [notfound=return] nis
networks: files
passwd: compat
passwd_compat: nis
shells: files
resolv.conf contains:
search 11md.local.
nameserver 172.17.11.61
/etc/hosts contains:
::1 localhost
127.0.0.1 localhost
>Fix:
Probably cast the port to "unsigned int" before passing it to snprintf().
>Release-Note:
>Audit-Trail:
>Unformatted: