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.
assigned to laroche
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.
*** Bug 11316 has been marked as a duplicate of this bug. ***
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.