Operating System - HP-UX
1752328 Members
5342 Online
108786 Solutions
New Discussion юеВ

nsswitch.compat and nsswitch.conf (points!)

 
Christian Deutsch_1
Esteemed Contributor

nsswitch.compat and nsswitch.conf (points!)

Hi folks,

I read in the following post (http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1286194069555+28353475&threadId=1233205), that name resolution "default behaviour" if there is no nsswitch.conf file can be seen in /etc/nsswitch.hp_defaults (and /etc/nsswitch.compat?).

So in fact, even if no nsswitch.conf file is present, name resolution via /etc/hosts will still work, e.g. using /usr/bin/nslookup on HP-UX 11.31. However, programs using gethostbyname() may be able to "accept" a certain IP address but *not* be able to resolve the hostname, even though it is present in /etc/hosts.

So what should I expect? Is it correct to assume that every HP-UX administrator will have an nsswitch.conf file anyway to ensure that programs relying on gethostbyname() will not fail?

Informed, helpful replies will be generously rewarded with points!

Thanks, Christian
Yeshua loves you!
2 REPLIES 2
Laurent Menase
Honored Contributor

Re: nsswitch.compat and nsswitch.conf (points!)

Hi,

Default behaviour is to try dns then /etc/hosts after a timeout

if you have no reslov.conf, the dns will be try on 127.0.0.1
.
So my advise:
Define exactly what you want to happen on gethostbyname in /etc/nsswitch.conf
and if you want the use of dns, then define a /etc/resolv.conf

if you don't want dns resolution it is very important to define a nsswitch.conf
rick jones
Honored Contributor

Re: nsswitch.compat and nsswitch.conf (points!)

Keep in mind that nslookup is not known for its slavish adherence to an nsswitch file.

FWIW, gethostbyname()/gethostbyaddr() is very "old school" these days - applications should be written to use getaddrinfo()/getnodeinfo().

there is no rest for the wicked yet the virtuous have no pillows