Hi Eial !

> does getent needs a valid host file in the system?

First of all, an empty file is a valid host file. As a missing file is
usually assumed to equal an empty file, the host file doesn't need to
be there either.

> after viewing both host and getent I'm sure that host is exactly what
> I've implemented. I don't think it is a good idea to base the
> implementation on getent.

host is a pure and direct DNS query which does NOT use gethostbyname
(or similar mechanism) to get any local stored name. On the other side
'getent hosts'  uses the libc functionality (also used by gethostbyname)
to query the IP address by it's name. glibc uses nsswitch to configure
how this query is done and this is usually 'host, bind': which
means it first tries to lookup the name in /etc/host and to query the
DNS server afterwards if not found locally.

If you use gethostbyname to query the IP address you have implemented
the functionality of 'getent hosts' with a single key (= name)
specification not the pure DNS based host command from bind package
(which does only DNS query and ignores locally provided addresses).

I hope that clarifies this.

--
Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to