glibc/glibc-rh1906066.patch
DistroBaker df9ce2ff57 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/glibc.git#525dee4c87180db08e1776ad3cb0e66a9b38e81f
2020-12-15 10:59:21 +00:00

60 lines
1.9 KiB
Diff

From d74a39158ab4aafa8af874e996bf5ddbde593bc0 Mon Sep 17 00:00:00 2001
From: DJ Delorie <dj@redhat.com>
Date: Wed, 9 Dec 2020 21:46:30 -0500
Subject: nsswitch: handle missing actions properly
Some internal functions need to know if a database has a nonzero
list of actions; success getting the database does not guarantee
that. Add checks for such as needed.
Skip the ":" in each nsswitch.conf line so as not to add a dummy
action libnss_:.so
diff --git a/grp/initgroups.c b/grp/initgroups.c
index a60ca1c395..a0a836d862 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -72,11 +72,13 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
nss_action_list nip;
- if (__nss_database_get (nss_database_initgroups, &nip))
+ if (__nss_database_get (nss_database_initgroups, &nip)
+ && nip != NULL)
{
use_initgroups_entry = true;
}
- else if (__nss_database_get (nss_database_group, &nip))
+ else if (__nss_database_get (nss_database_group, &nip)
+ && nip != NULL)
{
use_initgroups_entry = false;
}
diff --git a/nss/nss_database.c b/nss/nss_database.c
index e8c307d1f3..a036e95fbf 100644
--- a/nss/nss_database.c
+++ b/nss/nss_database.c
@@ -212,7 +212,8 @@ process_line (struct nss_database_data *data, char *line)
if (line[0] == '\0' || name == line)
/* Syntax error. Skip this line. */
return true;
- *line++ = '\0';
+ while (line[0] != '\0' && (isspace (line[0]) || line[0] == ':'))
+ *line++ = '\0';
int db = name_to_database_index (name);
if (db < 0)
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 40109c744d..921062e04f 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -81,7 +81,7 @@ __nss_database_lookup2 (const char *database, const char *alternate_name,
if (database_names[database_id] == NULL)
return -1;
- if (__nss_database_get (database_id, ni))
+ if (__nss_database_get (database_id, ni) && *ni)
{
/* Success. */
return 0;