summaryrefslogtreecommitdiffstats
path: root/source/nsswitch/winbind_nss.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-03 03:53:57 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-03 03:53:57 +0000
commitaee19090d3b957372b234a412cd9db8896650feb (patch)
treea12550e6d47ec74a199ce371b098afc6397ac09e /source/nsswitch/winbind_nss.c
parent142d3dad0ab6870acb0d46d1f189d5e2e1f71b17 (diff)
downloadsamba-aee19090d3b957372b234a412cd9db8896650feb.tar.gz
samba-aee19090d3b957372b234a412cd9db8896650feb.tar.xz
samba-aee19090d3b957372b234a412cd9db8896650feb.zip
fixed the nsswitch initgroups code
added a nsstest test program that directly tests all the nss interfaces using dlopen()
Diffstat (limited to 'source/nsswitch/winbind_nss.c')
-rw-r--r--source/nsswitch/winbind_nss.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/nsswitch/winbind_nss.c b/source/nsswitch/winbind_nss.c
index a2816bfdd3f..462c791277f 100644
--- a/source/nsswitch/winbind_nss.c
+++ b/source/nsswitch/winbind_nss.c
@@ -785,9 +785,9 @@ _nss_winbind_getgrgid_r(gid_t gid,
/* Initialise supplementary groups */
NSS_STATUS
-_nss_winbind_initgroups(char *user, gid_t group, long int *start,
- long int *size, gid_t *groups, long int limit,
- int *errnop)
+_nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+ long int *size, gid_t **groups, long int limit,
+ int *errnop)
{
NSS_STATUS ret;
struct winbindd_request request;
@@ -822,13 +822,15 @@ _nss_winbind_initgroups(char *user, gid_t group, long int *start,
/* Add to buffer */
if (*start == *size && limit <= 0) {
- groups = realloc(
- groups, 2 * (*size) * sizeof(*groups));
- if (!groups) goto done;
- *size *= 2;
+ (*groups) = realloc(
+ (*groups), (2 * (*size) + 1) * sizeof(**groups));
+ if (! *groups) goto done;
+ *size = 2 * (*size) + 1;
}
- groups[*start] = gid_list[i];
+ if (*start == *size) goto done;
+
+ (*groups)[*start] = gid_list[i];
*start += 1;
/* Filled buffer? */