Bug 144051 - search order defined in /etc/hosts.conf not respected.
search order defined in /etc/hosts.conf not respected.
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: bind (Show other bugs)
3
All Linux
medium Severity high
: ---
: ---
Assigned To: Jason Vas Dias
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-03 23:14 EST by Son To
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-04 19:24:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
lookup.c (5.51 KB, text/plain)
2005-01-04 19:23 EST, Jason Vas Dias
no flags Details

  None (edit)
Description Son To 2005-01-03 23:14:54 EST
Description of problem:
search order defined in /etc/hosts.conf not respected.

default /etc/hosts.conf:
  order hosts,bind

this should look in /etc/hosts file to resolve before going against
bind, but this is not the case. It searches dns server first.

Version-Release number of selected component (if applicable):


How reproducible:
always reproducible

Steps to Reproduce:
1. add entry in /etc/hosts like: 
192.168.1.1     foo.openbx.net          foo

2. run `host foo'

  
Actual results:
[root@gateway etc]# host foo
Host foo not found: 3(NXDOMAIN)


Expected results:
the ip address (192.168.1.1) of foo as defined in /etc/host

Additional info:
Comment 1 Jason Vas Dias 2005-01-04 19:22:43 EST
The file is :
                /etc/host.conf
                        ^
not             /etc/hosts.conf
                         ^

Actually, contrary to the resolver(3) man-page, host.conf is defunct -
its contents have no effect . (This may or may not be a glibc bug).

Only /etc/nsswitch.conf sets the search order - see nsswitch.conf(5).

However, the BIND host utility ONLY queries the DNS; it does, unlike
dig, use the 'search' list from /etc/resolv.conf, but DOES NOT use
/etc/host.conf nor /etc/nsswitch.conf .

It appears there is NO command-line utility to query a host using
gethostbyname(3). So I've appended the test utility I use to this
bug:
   $ gcc -o lookup lookup.c
   $ lookup localhost       # uses 'gethostbyname'
   $ lookup -d localhost    # uses 'getaddrinfo' - includes all RRs
 
 
Comment 2 Jason Vas Dias 2005-01-04 19:23:23 EST
Created attachment 109350 [details]
lookup.c

Note You need to log in before you can comment on or make changes to this bug.