On Wed, 2012-07-04 at 08:07 +0300, Eial Czerwacki wrote: > does getent needs a valid host file in the system? > > 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.
I didn't see your implementation in detail, but if it uses gethostbyname() or gethostent() etc. functions in GLIBC, then it IS NOT the standard host(1) utility. The host(1) utility communicates via the network to the current DNS server in /etc/resolv.conf (or the server specified on the host(1) command line, if given) and does hostname lookups directly from the DNS server. Consider this: if you do have a hostname in your /etc/hosts file but it doesn't exist in the DNS server, then host(1) will _not_ resolve the hostname. getent(1) will. Similarly, if you have a hostname in /etc/hosts which maps to a different IP address than that same hostname does on the DNS server, then host(1) will show the DNS server's IP address, NOT the one in /etc/hosts, regardless of the contents of nsswitch.conf etc. If you want to have a command-line interface to the get*ent() functions like getpwent(), getgrent(), gethostent(), gethostbyname(), etc., then the getent(1) utility is the (only, that I'm aware of) right answer. _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
