problem specifying port to ssh

Daniel Kahn Gillmor dkg-openssh.com at fifthhorseman.net
Fri Apr 7 13:15:10 EST 2006


On April 6, don-temp28 at isis.cs3-inc.com said:

 > Daniel Kahn Gillmor writes:
 > 
 >  > nisplus relies on a NIS+ server being present (and configured).  If
 >  > your workstation is looking for NIS+ information from a host that is
 >  > not providing it, it probably will fail.
 > In which case a well behaved glibc would go on to use the next method
 > in the list.  So I think this is a bug.

i agree: it sounds like this could potentially be a bug in your
nisplus nss module, for example.

 > This still doesn't explain why ssh -p 22 should be any different
 > from ssh without -p at all.  I'd expect the same underlying call
 > to one of the functions above, and I would expect the attempt to
 > resolve the host name to not depend on the port at all.

huh.  this is odd. from what Darren Tucker said:

 > > > The port number is passed to getaddrinfo() along with the
 > > > hostname.  It would appear that your system can handle hostname
 > > > alone, but isn't happy with both.

i'd expected that if you didn't supply the port, openssh would just
call getaddrinfo("isis.cs3-inc.com", NULL, ...) and then set
aitop->ai_addr->sin_port to 22 explicitly.

but (at least on my debian etch/sid system here) reviewing
ssh_connect() (in sshconnect.c [0]) shows that's not the case, and you're
right that it does appear to be the same call to getaddrinfo:

[dkg at squeak ~]$ ltrace -e getaddrinfo ssh fubar
getaddrinfo("fubar", "22", 0xbfe30c00, 0xbfe30c64) = -2
ssh: fubar: Name or service not known
+++ exited (status 255) +++
[dkg at squeak ~]$ ltrace -e getaddrinfo ssh -p 22 fubar
getaddrinfo("fubar", "22", 0xbfd765f0, 0xbfd76654) = -2
ssh: fubar: Name or service not known
+++ exited (status 255) +++
[dkg at squeak ~]$ ssh -V
OpenSSH_4.2p1 Debian-8.dkg1, OpenSSL 0.9.8a 11 Oct 2005
[dkg at squeak ~]$ 


What does your FC4 version of openssh-4.2p1 do with this library call?

	--dkg


[0] http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/sshconnect.c?rev=1.180&content-type=text/x-cvsweb-markup




More information about the openssh-unix-dev mailing list