about summary refs log tree commit diff
path: root/grp/initgroups.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-12-09 21:46:30 -0500
committerDJ Delorie <dj@redhat.com>2020-12-14 12:19:43 -0500
commitd2e929a907914e233d001d1dd5e3143e84fa69e0 (patch)
treee0fc726fa628727fee23a86a6053f9107502c84b /grp/initgroups.c
parent2ee7711bdd7de9dd30073b223ce29d5cd50320f6 (diff)
downloadglibc-d2e929a907914e233d001d1dd5e3143e84fa69e0.tar.gz
glibc-d2e929a907914e233d001d1dd5e3143e84fa69e0.tar.xz
glibc-d2e929a907914e233d001d1dd5e3143e84fa69e0.zip
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

See also https://bugzilla.redhat.com/show_bug.cgi?id=1906066

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'grp/initgroups.c')
-rw-r--r--grp/initgroups.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index a60ca1c395..22736a17e2 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;
     }