gethostbyname problem

From: Tatiana Robleda (trobleda@yahoo.es)
Date: Fri Jun 03 2005 - 10:50:41 EDT


Hi all,

  I'm having some problems with the gethostbyname function and maybe you can
help me to solve it.

  I've got a system running Solaris 9, the /etc/nsswitch.conf is configured
with:
        hosts: files dns
permissions: 644

  The /etc/hosts says:
        127.0.0.1 localhost
        10.0.0.01 mysystem loghost
        10.0.0.02 systemA domainA.org
        10.0.0.03 systemB domainB.org
permissions: 644

  The resolv.conf:
        domain domain.net
        nameserver 10.0.0.4
        search domain.net
permissions: 644

  Well, when I use the function gethostbyname in a perl programm

bash-2.05# /usr/local/bin/perl5.8.5 -e 'use Data::Dumper; my ($name,$aliases,
$addrtype,$length,@addrs)=gethostbyname("domainA.org"); ($a,$b,$c,$d) =
unpack('C4',$addrs[0]); print Dumper $a,$b,$c,$d'

instead of looking at the /etc/hosts it resolves the name by DNS. What I'm
missing? Why it doesn't try to solve first by looking at /etc/hosts?

  Thanks a lot

                
______________________________________________
Renovamos el Correo Yahoo!
Nuevos servicios, mas seguridad
http://correo.yahoo.es
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:49 EDT