On Fri, Oct 04, 2013 at 01:06:35PM -0500, Derek Martin wrote: > On Fri, Oct 04, 2013 at 12:06:29PM +0300, Alexander Gattin wrote: > > MUA may choose to operate offline, so some hacks around libresolv > > (like reading /etc/resolv.conf) are OK instead of just returning -1: > > NO, THEY ARE NOT. If your system is not using DNS for local name > resolution, then using anything in /etc/resolv.conf IS WRONG. PERIOD.
Yep, use the public APIs, of which /etc/resolv.conf is not. Note that Solaris has provided a name switch library, libnsl, for a loooong time. One of the reasons for it is that Solaris has supported NIS, NIS+, DNS and LDAP as naming data sources for some time and it was recognized that providing coherent/consistent configuration for these various data service was desirable and led to libnsl+/etc/nsswitch.conf. Calling libresolv directly can potentially bypass the intended hosts naming service. -- Will Fiveash