🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #2738

Re: gethostby*() failure diagnostics (was Re: pardon a simple(?) question...)

#2738
From: Neil Rickert
Date: Wed, 20 Jul 1994 12:42
39 lines
2611 bytes
In article <30ik1j$ctt@sunrise.gv.ssi1.com> gdonl@gv.ssi1.com (Don Lewis) writes:
>In article <30gm2c$5tp@rodan.UU.NET>, Rich Salz <rsalz@uunet.uu.net> wrote:
>>In <30enum$30q@sunrise.gv.ssi1.com> gdonl@gv.ssi1.com (Don Lewis) writes:
>
>[ nnrpd prints a message based on errno when gethostbyaddr() fails ]
>
>>>Nnrpd should be reporting the value of h_errno in this case rather than
>>>relying on perror() or its equivalent.
>>
>>Err, well, I dunno.
>>
>>Is h_errno really standard?  I don't think so, but I suppose I could be
>>convinced otherwise.

Rich is right to avoid h_errno here.

>I don't know if it is standard, but it seems to be really common.  It's
>documented in the man pages on HPUX and Apollo DomainOS.  The Apollo
>man page mentions herror(), which seems to be a perror() equivalent.
>Both h_errno and herror() are mentioned in the man page included in
>the beta distribution of BIND 4.9.3.  The SunOS 4.1.x man page does not
>document h_errno, but it's defined in the include file <netdb.h>.  I
>don't have any other Un*x boxes handy that I can examine.

One must be careful about interpreting man pages and header files.  In
practice, h_errno is a diagnostic from the resolver library.  If host
lookups are done differently, then it does not apply.  On a SunOS 4.1.x
system set up according to vendor recommendations, gethostbyname() uses
a NIS lookup.  The NIS server in turn might use the resolver.  But when
this happens, h_errno is available to the NIS server, but not to the
client making the lookup via a network connection to the NIS server.

>None of the man pages document errno being set if gethostby*() fails.

This is probably correct.  If you are not doing a direct resolver
lookup, a nameserver timeout may be indistinguishable from "unknown
host".

Technical Details
Message-ID: <1994Jul20.124227.20314@mp.cs.niu.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.programmer.mbox.zip!nntp.gmd.de!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!mp.cs.niu.edu!rickert
References: <30enum$30q@sunrise.gv.ssi1.com> <30gm2c$5tp@rodan.UU.NET> <30ik1j$ctt@sunrise.gv.ssi1.com>

Show Full Headers
Complete Article Headers
Message-ID: <1994Jul20.124227.20314@mp.cs.niu.edu>
Subject: Re: gethostby*() failure diagnostics (was Re: pardon a simple(?) question...)
Date: Wed, 20 Jul 1994 12:42:27 GMT
From: rickert@mp.cs.niu.edu (Neil Rickert)
References: <30enum$30q@sunrise.gv.ssi1.com> <30gm2c$5tp@rodan.UU.NET> <30ik1j$ctt@sunrise.gv.ssi1.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.programmer.mbox.zip!nntp.gmd.de!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!mp.cs.niu.edu!rickert
Newsgroups: news.software.nntp,comp.unix.programmer
Organization: Northern Illinois University
Distribution: inet
Lines: 38