Bug 11928 - nscd does not account for 'multi on' in /etc/host.conf when ai-resolving hosts
Summary: nscd does not account for 'multi on' in /etc/host.conf when ai-resolving hosts
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nscd (show other bugs)
Version: 2.12
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 11536 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-19 20:14 UTC by Petr Baudis
Modified: 2014-06-30 08:15 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
proposed patch (600 bytes, patch)
2010-08-19 20:23 UTC, Petr Baudis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Baudis 2010-08-19 20:14:51 UTC
When nscd is handling getaddrinfo() resolution requests, it fails to properly
initialize its resolver options state and ignores /etc/host.conf. An easy way to
reproduce this is by putting 'multi on' in /etc/host.conf and

cat >>/etc/host.conf <<EOT
1.2.3.4 test
1.2.3.5 test
EOT

Then, with nscd stopped:
$ getent ahosts test
1.2.3.4         STREAM test
1.2.3.4         DGRAM  
1.2.3.4         RAW    
1.2.3.5         STREAM 
1.2.3.5         DGRAM  
1.2.3.5         RAW    

However, with nscd running:
$ getent ahosts test
1.2.3.4         STREAM test
1.2.3.4         DGRAM  
1.2.3.4         RAW
Comment 1 Petr Baudis 2010-08-19 20:23:14 UTC
Created attachment 4940 [details]
proposed patch

This patch makes sure _res_hconf is initialized before resolving is being done.
However, this would not be enough since nscd has its own _res_hconf due to
nscd/res_hconf.c; _res_hconf_init() would work on different _res_hconf instance
than the NSS routines. We just need to make sure nscd and glibc share the same
_res_hconf instance - this should not be a problem since users should run
matching versions of glibc and nscd anyway.
Comment 2 Petr Baudis 2010-08-22 14:42:08 UTC
*** Bug 11536 has been marked as a duplicate of this bug. ***
Comment 3 Ondrej Bilka 2013-10-08 16:00:49 UTC
Attached patch is already at trunk.