Bug 11235

Summary: ypbind won't find servers from /etc/hosts
Product: [Retired] Red Hat Linux Reporter: mandrews
Component: ypbindAssignee: Preston Brown <pbrown>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: laroche
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-16 19:20:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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.