On Wed, Jun 08, 2016 at 10:59:00AM BST, Marcus MERIGHI wrote:
> I would not expect getent(1) ("get entries from administrative
> database") to do network DNS lookups.

Yes, it even says so in the man page

man 1 getent

        The order in which entries are looked up
        is defined by the specific database (for example, the lookup order for
        the “hosts” database is determined by resolv.conf(5)).

I do understand where the confusion comes from though - it's the naming:

        getent hosts database != /etc/hosts file

However, the same goes for:

        getent passwd database != /etc/passwd file

as the former will also include YP accounts if configured.

Etc...

Regards,

Raf

> Usual sendbug(1) machine info omitted because it applies to all machines
> I have access to - though these are all amd64.
> 
> Reproduce:
> 
> have a default hosts(5):
> 127.0.0.1       localhost
> ::1             localhost
> 
> have a working nameserver in resolv.conf(5).
> 
> then run the following commands:
> 
> $ getent hosts 8.8.8.7
> 8.8.8.7                                 8.8.8.7
> 
> $ getent hosts 8.8.8.8
> 8.8.8.8           google-public-dns-a.google.com
> 
> $ getent hosts www.openbsd.org   
> 129.128.5.194                           www.openbsd.org
> 
> To me this looks like getent(1) does network dns resolution instead of
> returning "no result" if there is no matching entry in hosts(5).
> 
> I can see the lookups in unbound(8)s logs in case of local resolving via
> resolv.conf(5).
> 
> Bye, Marcus
> 

Reply via email to