Subject: Re: gethostent()
To: Wenchi Liao <wliao@midway.uchicago.edu>
From: Andrew Brown <atatat@atatdot.net>
List: netbsd-help
Date: 07/18/1999 11:28:22
>Compiling nmh-1.0.1 on i386-netbsd-1.4, and running into
>some errors with gethostent().
>
>man gethostent returns
>
>GETHOSTBYNAME(3) NetBSD Programmer's Manual GETHOSTBYNAME(3)
>
>NAME
> gethostbyname, gethostbyaddr, gethostent, sethostent, endhostent, herror,
> hstrerror - get network host entry
>
>LIBRARY
> Standard C Library (libc, -lc)
>
>
>but linking code that uses gethostent() results in a
>unreferenced symbol error by ld.
the man page also says:
CAVEAT
The gethostent() function is defined, and sethostent() and endhostent()
are redefined, when libc(3) is built to use only the routines to lookup
in /etc/hosts and not the name server.
so in order to support the gethostent() function, you'd have to build
libraries without dns support.
>Linking against -lresolv doesn't work, either. Actually, a
>quick "nm /usr/lib/lib* | grep -i gethostent" doesn't turn
>up anything.
nope...it's not there either. for gethostent to work with dns,
gethostent() would have to pull a zone transfer of a zone that's not
guaranteed to be designated anywhere. i guess it could just pull on
the "domain" or "search" directives from /etc/resolv.conf, but the
server could be configured not to allow axfr's and then you're back at
square one.
it'd also have to deal with /etc/hosts, in accordance with nsswitch.conf
>Suggestions?
figure out why nmh wants gethostent() and work around it?
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
andrew@crossbar.com * "information is power -- share the wealth."