mirror of git://sourceware.org/git/glibc.git
Fix handling of initgroups database.
This commit is contained in:
parent
a9e836b040
commit
c41af17eed
|
|
@ -1,5 +1,10 @@
|
||||||
2011-06-15 Ulrich Drepper <drepper@gmail.com>
|
2011-06-15 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* grp/initgroups.c (__nss_initgroups_database): Renamed and exported.
|
||||||
|
(internal_getgrouplist): Adjust to name change.
|
||||||
|
Update use_initgroups_entry if this is not the first call.
|
||||||
|
* nss/databases.def: Add initgroups entry.
|
||||||
|
|
||||||
* nss/makedb.c (compute_tables): Check result of multiple hash table
|
* nss/makedb.c (compute_tables): Check result of multiple hash table
|
||||||
sizes to minimize maximum chain length.
|
sizes to minimize maximum chain length.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ extern int __nss_group_lookup (service_user **nip, const char *name,
|
||||||
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
|
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
|
||||||
|
|
||||||
extern service_user *__nss_group_database attribute_hidden;
|
extern service_user *__nss_group_database attribute_hidden;
|
||||||
static service_user *initgroups_database;
|
service_user *__nss_initgroups_database;
|
||||||
static bool use_initgroups_entry;
|
static bool use_initgroups_entry;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -80,26 +80,31 @@ internal_getgrouplist (const char *user, gid_t group, long int *size,
|
||||||
/* Start is one, because we have the first group as parameter. */
|
/* Start is one, because we have the first group as parameter. */
|
||||||
long int start = 1;
|
long int start = 1;
|
||||||
|
|
||||||
if (initgroups_database == NULL)
|
if (__nss_initgroups_database == NULL)
|
||||||
{
|
{
|
||||||
no_more = __nss_database_lookup ("initgroups", NULL, "",
|
no_more = __nss_database_lookup ("initgroups", NULL, "",
|
||||||
&initgroups_database);
|
&__nss_initgroups_database);
|
||||||
if (no_more == 0 && initgroups_database == NULL)
|
if (no_more == 0 && __nss_initgroups_database == NULL)
|
||||||
{
|
{
|
||||||
if (__nss_group_database == NULL)
|
if (__nss_group_database == NULL)
|
||||||
no_more = __nss_database_lookup ("group", NULL, "compat files",
|
no_more = __nss_database_lookup ("group", NULL, "compat files",
|
||||||
&__nss_group_database);
|
&__nss_group_database);
|
||||||
|
|
||||||
initgroups_database = __nss_group_database;
|
__nss_initgroups_database = __nss_group_database;
|
||||||
}
|
}
|
||||||
else if (initgroups_database != NULL)
|
else if (__nss_initgroups_database != NULL)
|
||||||
{
|
{
|
||||||
assert (no_more == 0);
|
assert (no_more == 0);
|
||||||
use_initgroups_entry = true;
|
use_initgroups_entry = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
/* __nss_initgroups_database might have been set through
|
||||||
|
__nss_configure_lookup in which case use_initgroups_entry was
|
||||||
|
not set here. */
|
||||||
|
use_initgroups_entry = __nss_initgroups_database != __nss_group_database;
|
||||||
|
|
||||||
service_user *nip = initgroups_database;
|
service_user *nip = __nss_initgroups_database;
|
||||||
while (! no_more)
|
while (! no_more)
|
||||||
{
|
{
|
||||||
long int prev_start = start;
|
long int prev_start = start;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* List of all databases defined for the NSS in GNU C Library.
|
/* List of all databases defined for the NSS in GNU C Library.
|
||||||
Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@ DEFINE_DATABASE (aliases)
|
||||||
DEFINE_DATABASE (ethers)
|
DEFINE_DATABASE (ethers)
|
||||||
DEFINE_DATABASE (group)
|
DEFINE_DATABASE (group)
|
||||||
DEFINE_DATABASE (hosts)
|
DEFINE_DATABASE (hosts)
|
||||||
|
DEFINE_DATABASE (initgroups)
|
||||||
DEFINE_DATABASE (netgroup)
|
DEFINE_DATABASE (netgroup)
|
||||||
DEFINE_DATABASE (networks)
|
DEFINE_DATABASE (networks)
|
||||||
DEFINE_DATABASE (passwd)
|
DEFINE_DATABASE (passwd)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue