aboutsummaryrefslogtreecommitdiff
path: root/nis/nss_nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-24 01:26:01 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-24 01:26:01 +0000
commitcf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3 (patch)
tree2da802067a7b55b2580a49786505794ace48ac0c /nis/nss_nis
parent945b22ed04767342dac1654f7e92ad5f8870361b (diff)
downloadglibc-cf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3.tar
glibc-cf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3.tar.gz
glibc-cf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3.tar.bz2
glibc-cf9e9ad98feb55d11f93aa4e069c81ee06c2a6a3.zip
Update.
* grp/initgroups.c (initgroups): Don't limit the possible number of groups to NGROUPS_MAX. Allow dynamic resizing. Loop around the setgroups call while the call fails and descrease the number of groups each round. The name of the initgroups function in the NSS modules changed. (compat_call): Adapt for dynamic resizing. * hesiod/nss_hesiod/hesiod-grp.c (_nss_hesiod_initgroups_dyn): Implement dynamic resizing. * nis/nss_compat/compat-initgroups.c (_nss_compat_initgroups_dyn): Likewise. * nis/nss_nis/compat-initgroups.c (_nss_nis_initgroups_dyn): Likewise. * hesiod/Versions: Change exported interface name. * nis/Versions: Change exported interface name. 2000-07-23 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'nis/nss_nis')
-rw-r--r--nis/nss_nis/nis-initgroups.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 9e18a2027a..ec13dbd140 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -137,15 +137,15 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
}
enum nss_status
-_nss_nis_initgroups (const char *user, gid_t group, long int *start,
- long int *size, gid_t *groups, long int limit,
- int *errnop)
+_nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
+ long int *size, gid_t **groupsp, int *errnop)
{
struct group grpbuf, *g;
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *tmpbuf;
enum nss_status status;
intern_t intern = { NULL, NULL };
+ gid_t *groups = *groupsp;
status = internal_setgrent (&intern);
if (status != NSS_STATUS_SUCCESS)
@@ -177,22 +177,20 @@ _nss_nis_initgroups (const char *user, gid_t group, long int *start,
if (strcmp (*m, user) == 0)
{
/* Matches user. Insert this group. */
- if (*start == *size && limit <= 0)
+ if (*start == *size)
{
/* Need a bigger buffer. */
- groups = realloc (groups, 2 * *size * sizeof (*groups));
- if (groups == NULL)
+ gid_t *newgroups;
+ newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+ if (newgroups == NULL)
goto done;
+ *groupsp = groups = newgroups;
*size *= 2;
}
groups[*start] = g->gr_gid;
*start += 1;
- if (*start == limit)
- /* Can't take any more groups; stop searching. */
- goto done;
-
break;
}
}