Bug 11235 - ypbind won't find servers from /etc/hosts
Summary: ypbind won't find servers from /etc/hosts
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ypbind
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Preston Brown
QA Contact:
: 11316 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2000-05-05 01:37 UTC by mandrews
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2000-10-16 19:20:39 UTC

Attachments (Terms of Use)

Description mandrews 2000-05-05 01:37:51 UTC
ypbind will not locate hosts whose names are defined in /etc/hosts. This
problem exists in redhat 6.1 and 6.2.

Looks like the problem is in res_gethostbyname (so not really ypbind -
glibc I guess), because when I replaced the call to res_gethostbyname with
gethostbyname and recompiled the problem was fixed.

Comment 1 Cristian Gafton 2000-05-22 15:54:59 UTC
assigned to laroche

Comment 2 Preston Brown 2000-10-16 18:59:08 UTC
res_gethostbyname by definition only uses the resolver, not /etc/hosts, for name
lookup, so there is no problem there.

The question is why ypbind is using the res_  function instead of the regular
glibc function.  I have mailed the author for clarification.

Comment 3 Preston Brown 2000-10-16 19:20:36 UTC
*** Bug 11316 has been marked as a duplicate of this bug. ***

Comment 4 Preston Brown 2000-10-16 19:39:32 UTC
Answer from the program author:

res_gethostbyname in ypbind-mt is only used if we don't have 
__nss_configure_lookup. The reason is simple: To avoid a deadlock.

If we would use gethostbyname, we are not allowed to add "nis" to
the hosts entry in /etc/nsswitch.conf. So we only allow IP numbers
or use DNS (res_gethostbyname).
But if we have __nss_configure_lookup, we can override the rule in
/etc/nsswitch.conf to use only /etc/hosts and then DNS.
With glibc 2.1 and 2.2 /etc/hosts and DNS should be allowed.


I.e., this is intentional behaviour.  List the IP address of your NIS server if
the machine is also a DNS server, or if there is no DNS entry.

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