This is the mail archive of the glibc-bugs@sourceware.org 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/11536] New: host config not honored in aicache


/etc/host.conf setup is not honored during addrinfo lookups in nscd. In
particular, 'multi on' is usually set in this file and honored by nss_files, but
if /etc/hosts contains multiple AF entries per host (e.g. localhost as both
127.0.0.1 and ::1), without nscd running `getent ahosts localhost` returns both
entries, but with nscd running, only the first one is returned.

The problem is that _res_hconf_init() is never being called in the addhstaiX()
code path, so gethostbyname4_r() in nss_files is testing the MULTI flag on
uninitialized hconf structure. However, it cannot be added to the function in a
straightforward way since _res_hconf is not being exported and to make matters
more confusing, a local instance is created by nscd/res_hconf.c.

The immediate workaround for distributions is to disable gethostbyname4_r()
calls in addhstaiX(). I'm not so sure about the proper fix, though. Alternatives
I can think of:

1. Initialize hconf in gethostbyname4_r() instead of the caller. Comes at very
slight efficiency loss, but it's the simplest and I think the best short-term
solution.

2. Export _res_hconf. Would somewhat freeze its ABI but allow us to also get rid
of nscd/res_hconf.c. (Also, I don't think it would be a problem to add more
requirements on matching nscd and glibc versions.)

3. Rewrite the addhstaiX() to just proxy getaddrinfo() instead of reimplementing
it - I wonder why is it not implemented like that?

-- 
           Summary: host config not honored in aicache
           Product: glibc
           Version: 2.11
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nscd
        AssignedTo: drepper at redhat dot com
        ReportedBy: pasky at suse dot cz
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11536

------- 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]