Bug 144051 - search order defined in /etc/hosts.conf not respected.
Summary: search order defined in /etc/hosts.conf not respected.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: bind
Version: 3
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-01-04 04:14 UTC by Son To
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-01-05 00:24:57 UTC
Type: ---
Embargoed:


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

Description Son To 2005-01-04 04:14:54 UTC
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-05 00:22:43 UTC
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-05 00:23:23 UTC
Created attachment 109350 [details]
lookup.c


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