summaryrefslogtreecommitdiff
path: root/source3/nsswitch
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
commit37749cbb04b0c863566b30392fe071e6b48df17d (patch)
tree02e96463f2493133b183b14896f4e840c20597c5 /source3/nsswitch
parente0adf6e27ef7d66be5908aba4466cc11b3841eab (diff)
downloadsamba-37749cbb04b0c863566b30392fe071e6b48df17d.tar.gz
samba-37749cbb04b0c863566b30392fe071e6b48df17d.tar.bz2
samba-37749cbb04b0c863566b30392fe071e6b48df17d.zip
fixed the nsswitch initgroups code
added a nsstest test program that directly tests all the nss interfaces using dlopen() (This used to be commit aee19090d3b957372b234a412cd9db8896650feb)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbind_nss.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/nsswitch/winbind_nss.c b/source3/nsswitch/winbind_nss.c
index a2816bfdd3..462c791277 100644
--- a/source3/nsswitch/winbind_nss.c
+++ b/source3/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? */