This is the mail archive of the glibc-bugs@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nscd/202] New: nss always tries to connect to nscd daemon for host name resolution


a program resolving host names attempts to connect several times to nscd
daemon even when it is not running. This is due to a bug in 
nscd/nscd_gethst_r.c which uses __nss_not_use_nscd_group variable instead of
__nss_not_use_nscd_hosts :

Excerpt from nscd/nscd_gethst_r.c :
int __nss_not_use_nscd_hosts;
.....
.....

static int
internal_function
nscd_gethst_r (const char *key, size_t keylen, request_type type,
              struct hostent *resultbuf, char *buffer, size_t buflen,
              int *h_errnop)
{
 int sock = open_socket ();
 hst_response_header hst_resp;
 request_header req;
 ssize_t nbytes;
 struct iovec vec[4];

 if (sock == -1)
   {
     __nss_not_use_nscd_group = 1;
     return -1;
   }
......
......
 if (hst_resp.found == -1)
   {
     /* The daemon does not cache this database.  */
     __close (sock);
     __nss_not_use_nscd_hosts = 1;
     return -1;
   }

# cat /etc/host.conf
order hosts,bind
# grep "^host" /etc/nsswitch.conf
hosts:      files dns
# strace -e trace=open,connect ./gethostbyname foo bar
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libc.so.6", O_RDONLY)        = 3
open("/etc/resolv.conf", O_RDONLY)      = 3
connect(3, {sin_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) = -1 ENOENT
(No such file or directory)
open("/etc/nsswitch.conf", O_RDONLY)    = 3
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libnss_files.so.2", O_RDONLY) = 3
open("/etc/host.conf", O_RDONLY)        = 3
open("/etc/hosts", O_RDONLY)            = 3
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib/libnss_dns.so.2", O_RDONLY)  = 3
open("/lib/libresolv.so.2", O_RDONLY)   = 3
connect(3, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("132.165.65.6")}}, 28) = 0
connect(3, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("132.165.65.6")}}, 28) = 0
./gethostbyname: foo unknown host
connect(3, {sin_family=AF_UNIX, path="/var/run/.nscd_socket"}, 110) = -1 ENOENT
(No such file or directory)
open("/etc/hosts", O_RDONLY)            = 3
connect(3, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("132.165.65.6")}}, 28) = 0
connect(3, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("132.165.65.6")}}, 28) = 0
./gethostbyname: bar unknown host

-- 
           Summary: nss always tries to connect to nscd daemon for host name
                    resolution
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nscd
        AssignedTo: drepper at redhat dot com
        ReportedBy: Philippe dot Gregoire at cea dot fr
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=202

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]