On Fri, Feb 15, 2002 at 01:49:01PM -0200, Denis Vlasenko wrote:> [Please CC me, I'm not on the list] > > My box is on a mostly Windows-populated network. > Naturally, I set up Samba and added WINS as a name resolution option. > > I found out that some programs now can use NetBIOS names, other can't. > openssh falls into latter category :-( > > I found that openssh use this snippet to convert hostname to ip: > > if((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) > fatal("%s: %.100s: %s", __progname, host, > gai_strerror(gaierr)); > > and it fails for me exactly in this if() when I say "ssh <wins_name>". > OTOH, ping uses code similar to > > struct hostent *hp; > hp = gethostbyname(hostname); > > and this works for WINS names.You must have a 'wins' entry in your nsswitch.conf. I guess getaddrinfo() doesn't support nsswitch correctly. Judging by this email: <http://mail-index.netbsd.org/tech-net/2000/02/15/0004.html> I'd say it doesn't. /fc
Hi, On Fri, Feb 15, 2002 at 01:49:01PM -0200, Denis Vlasenko wrote:> I found that openssh use this snippet to convert hostname to ip: > > if((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) > fatal("%s: %.100s: %s", __progname, host, > gai_strerror(gaierr));This is the "best" and *current* way to do hostname to IP resolution.> and it fails for me exactly in this if() when I say "ssh <wins_name>". > OTOH, ping uses code similar to > > struct hostent *hp; > hp = gethostbyname(hostname);This is "the old way", which can't do IPv6 (and has other limitations).> and this works for WINS names.Sounds like a microsoft weirdness to me... gert -- USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany gert at greenie.muc.de fax: +49-89-35655025 gert.doering at physik.tu-muenchen.de
[Please CC me, I'm not on the list] My box is on a mostly Windows-populated network. Naturally, I set up Samba and added WINS as a name resolution option. I found out that some programs now can use NetBIOS names, other can't. openssh falls into latter category :-( I found that openssh use this snippet to convert hostname to ip: if((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) fatal("%s: %.100s: %s", __progname, host, gai_strerror(gaierr)); and it fails for me exactly in this if() when I say "ssh <wins_name>". OTOH, ping uses code similar to struct hostent *hp; hp = gethostbyname(hostname); and this works for WINS names. My openssh version: openssh-3.0.2p1 Will try to patch ssh, although I'm know nothing about network programming. Happy hacking, -- vda
On Fri, 15 Feb 2002, Denis Vlasenko wrote:> [Please CC me, I'm not on the list] > > My box is on a mostly Windows-populated network. > Naturally, I set up Samba and added WINS as a name resolution option. > > I found out that some programs now can use NetBIOS names, other can't. > openssh falls into latter category :-( > > I found that openssh use this snippet to convert hostname to ip: > > if((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) > fatal("%s: %.100s: %s", __progname, host, > gai_strerror(gaierr)); > > and it fails for me exactly in this if() when I say "ssh <wins_name>". > OTOH, ping uses code similar to > > struct hostent *hp; > hp = gethostbyname(hostname); > > and this works for WINS names.If you do this, you'll lose IPv6 capability. -d