1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
* string/endian.h: Explain the _*_ENDIAN constant values a bit
	more.  Patch by scarlet@mit.edu [PR libc/1799].

	* io/ftwtest-sh: Add -f parameter to chmod if -R is also given.
	[PR libc/1792].

	* argp/argp-parse.c (parser_finalize): Reverse order in which
	parsers are run for ARGP_KEY_END.  [PR libc/1755].
This commit is contained in:
Ulrich Drepper
2000-07-24 05:41:25 +00:00
parent cf9e9ad98f
commit 7603ea28d3
10 changed files with 110 additions and 51 deletions

View File

@@ -49,7 +49,7 @@ extern service_user *__nss_group_database;
static enum nss_status
compat_call (service_user *nip, const char *user, gid_t group, long int *start,
long int *size, gid_t **groupsp, int *errnop)
long int *size, gid_t **groupsp, long int limit, int *errnop)
{
struct group grpbuf;
size_t buflen = __sysconf (_SC_GETGR_R_SIZE_MAX);
@@ -102,11 +102,22 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
{
/* Need a bigger buffer. */
gid_t *newgroups;
newgroups = realloc (groups, 2 * *size * sizeof (*groups));
long int newsize;
if (limit > 0 && *size == limit)
/* We reached the maximum. */
goto done;
if (limit <= 0)
newsize = 2 * *size;
else
newsize = MIN (limit, 2 * *size);
newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
goto done;
*groupsp = groups = newgroups;
*size *= 2;
*size = newsize;
}
groups[*start] = grpbuf.gr_gid;
@@ -147,10 +158,12 @@ initgroups (user, group)
/* Start is one, because we have the first group as parameter. */
long int start = 1;
long int size;
long int limit;
gid_t *groups;
int result;
#ifdef NGROUPS_MAX
size = NGROUPS_MAX;
limit = -1;
#else
long int limit = __sysconf (_SC_NGROUPS_MAX);
@@ -184,14 +197,14 @@ initgroups (user, group)
if (fct == NULL)
{
status = compat_call (nip, user, group, &start, &size, &groups,
&errno);
limit, &errno);
if (nss_next_action (nip, NSS_STATUS_UNAVAIL) != NSS_ACTION_CONTINUE)
break;
}
else
status = DL_CALL_FCT (fct, (user, group, &start, &size, &groups,
&errno));
limit, &errno));
/* This is really only for debugging. */
if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)