This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 1912
  gethostbyname2()/getaddrinfo() skips /etc/hosts with --enable-static-nss Last modified: 2005-11-25 16:42
     Query page      Enter new bug
Bug#: 1912   Hardware:   Reporter: Dave Johnson <djohnson+sourceware@sw.starentnetworks.com>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: Ulrich Drepper <drepper@redhat.com>   Target Milestone:  
Flags: Requestee:
  backport ()
  examined ()
  testsuite ()
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 1912 depends on: Show dependency tree
Show dependency graph
Bug 1912 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2005-11-22 23:00
When built with --enable-static-nss, gethostbyname2() and functions that call 
it like getaddrinfo() will only do dns lookups and not try /etc/hosts like
gethostbyname() will.

__nss_lookup_function() for gethostbyname2() will try _nss_dns_gethostbyname2_r,
but not _nss_files_gethostbyname2_r.

I'm using an old 2.2.x version, but it appears missing in the code for 2.3.5 as
well.

Below patch will fix the problem:

--- old/nss/function.def 2002-02-21 16:57:50 -05:00
+++ new/nss/function.def 2005-11-22 15:40:48 -05:00
@@ -37,6 +37,7 @@
 DEFINE_ENT (files, host)
 DEFINE_GETBY (files, host, addr)
 DEFINE_GETBY (files, host, name)
+DEFINE_GETBY (files, host, name2)
 DEFINE_GET (files, hostton)
 DEFINE_GET (files, ntohost)
 DEFINE_GETBY (dns, host, addr)

------- Additional Comment #1 From Ulrich Drepper 2005-11-25 16:42 -------
Although it should not matter since static NSS is only meant for initial porting
I added the change.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In