Correctly handle missing initgroups database
authorAndreas Schwab <schwab@redhat.com>
Fri, 14 Oct 2011 15:57:07 +0000 (17:57 +0200)
committerAndreas Schwab <schwab@redhat.com>
Mon, 17 Oct 2011 07:53:10 +0000 (09:53 +0200)
ChangeLog
grp/initgroups.c

index dfd6a3b..ab651ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-17  Andreas Schwab  <schwab@redhat.com>
+
+       * grp/initgroups.c (internal_getgrouplist): Fix initgroups
+       database lookup.
+
 2011-10-16  Ulrich Drepper  <drepper@gmail.com>
 
        * misc/sys/cdefs.h: Use leaf function attribute in __THROW.
index 48119ff..c63bba1 100644 (file)
@@ -82,9 +82,8 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
 
   if (__nss_initgroups_database == NULL)
     {
-      no_more = __nss_database_lookup ("initgroups", NULL, "",
-                                      &__nss_initgroups_database);
-      if (no_more == 0 && __nss_initgroups_database == NULL)
+      if (__nss_database_lookup ("initgroups", NULL, "",
+                                &__nss_initgroups_database) < 0)
        {
          if (__nss_group_database == NULL)
            no_more = __nss_database_lookup ("group", NULL, "compat files",
@@ -92,11 +91,8 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
 
          __nss_initgroups_database = __nss_group_database;
        }
-      else if (__nss_initgroups_database != NULL)
-       {
-         assert (no_more == 0);
-         use_initgroups_entry = true;
-       }
+      else
+       use_initgroups_entry = true;
     }
   else
     /* __nss_initgroups_database might have been set through