]> git.ipfire.org Git - thirdparty/glibc.git/commit - nss/XXX-lookup.c
nss: Use "files dns" as the default for the hosts database (bug 28700)
authorFlorian Weimer <fweimer@redhat.com>
Fri, 17 Dec 2021 11:01:20 +0000 (12:01 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 17 Dec 2021 11:01:25 +0000 (12:01 +0100)
commitb99b0f93ee8762fe53ff65802deb6f00700b9924
treee8d5ed3899507030413f48489daee39aead1b713
parentce1e5b11229f19820b86f8b19d651f16009552b0
nss: Use "files dns" as the default for the hosts database (bug 28700)

This matches what is currently in nss/nsswitch.conf.  The new ordering
matches what most distributions use in their installed configuration
files.

It is common to add localhost to /etc/hosts because the name does not
exist in the DNS, but is commonly used as a host name.

With the built-in "dns [!UNAVAIL=return] files" default, dns is
searched first and provides an answer for "localhost" (NXDOMAIN).
We never look at the files database as a result, so the contents of
/etc/hosts is ignored.  This means that "getent hosts localhost"
fail without a /etc/nsswitch.conf file, even though the host name
is listed in /etc/hosts.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
manual/nss.texi
nss/XXX-lookup.c
nss/nss_database.c