aboutsummaryrefslogtreecommitdiff
path: root/nss
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-12-17 12:01:20 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-12-17 12:17:18 +0100
commitdc9b69d5331dcdca4547c0490cb9fefbd89e40f6 (patch)
treea1f506d552e15ef8cbf3b2185228feaaa2e29397 /nss
parent93aabf891e96e93f100081ee07989c23d7107d17 (diff)
downloadglibc-dc9b69d5331dcdca4547c0490cb9fefbd89e40f6.tar.xz
glibc-dc9b69d5331dcdca4547c0490cb9fefbd89e40f6.zip
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> (cherry picked from commit b99b0f93ee8762fe53ff65802deb6f00700b9924)
Diffstat (limited to 'nss')
-rw-r--r--nss/XXX-lookup.c2
-rw-r--r--nss/nss_database.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/nss/XXX-lookup.c b/nss/XXX-lookup.c
index f1c97f7c8e..dbc87868dd 100644
--- a/nss/XXX-lookup.c
+++ b/nss/XXX-lookup.c
@@ -29,7 +29,7 @@
|* ALTERNATE_NAME - name of another service which is examined in *|
|* case DATABASE_NAME is not found *|
|* *|
-|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *|
+|* DEFAULT_CONFIG - string for default conf (e.g. "files dns") *|
|* *|
\*******************************************************************/
diff --git a/nss/nss_database.c b/nss/nss_database.c
index ab121cb371..54561f0328 100644
--- a/nss/nss_database.c
+++ b/nss/nss_database.c
@@ -80,7 +80,7 @@ enum nss_database_default
{
nss_database_default_defconfig = 0, /* "nis [NOTFOUND=return] files". */
nss_database_default_compat, /* "compat [NOTFOUND=return] files". */
- nss_database_default_dns, /* "dns [!UNAVAIL=return] files". */
+ nss_database_default_dns, /* "files dns". */
nss_database_default_files, /* "files". */
nss_database_default_nis, /* "nis". */
nss_database_default_nis_nisplus, /* "nis nisplus". */
@@ -133,7 +133,7 @@ nss_database_select_default (struct nss_database_default_cache *cache,
#endif
case nss_database_default_dns:
- line = "dns [!UNAVAIL=return] files";
+ line = "files dns";
break;
case nss_database_default_files: