diff options
author | Jeremy Allison <jra@samba.org> | 2007-05-12 01:08:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:22:00 -0500 |
commit | a4b034d19544601129eb1b7db75b1c2973246e36 (patch) | |
tree | bed6ff25433d2d379625b51c5c9e717ac2bb84b9 /source3/nsswitch/winbindd_group.c | |
parent | 0484aca691c727ce4694924db6daac82011d1740 (diff) | |
download | samba-a4b034d19544601129eb1b7db75b1c2973246e36.tar.gz samba-a4b034d19544601129eb1b7db75b1c2973246e36.tar.bz2 samba-a4b034d19544601129eb1b7db75b1c2973246e36.zip |
r22812: Fix bug #3024 (and also the group varient). Patch from
Johann Hanne <jhml@gmx.net> and also Kaya Bekiro?lu <kaya.bekiroglu@isilon.com>
Jeremy.
(This used to be commit c0ba891be06f49968317a90079554cfce2344f39)
Diffstat (limited to 'source3/nsswitch/winbindd_group.c')
-rw-r--r-- | source3/nsswitch/winbindd_group.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c index 21ad73a70e..1500324583 100644 --- a/source3/nsswitch/winbindd_group.c +++ b/source3/nsswitch/winbindd_group.c @@ -902,7 +902,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state) { struct getent_state *ent; struct winbindd_gr *group_list = NULL; - int num_groups, group_list_ndx = 0, i, gr_mem_list_len = 0; + int num_groups, group_list_ndx, gr_mem_list_len = 0; char *gr_mem_list = NULL; DEBUG(3, ("[%5lu]: getgrent\n", (unsigned long)state->pid)); @@ -916,6 +916,11 @@ void winbindd_getgrent(struct winbindd_cli_state *state) num_groups = MIN(MAX_GETGRENT_GROUPS, state->request.data.num_entries); + if (num_groups == 0) { + request_error(state); + return; + } + if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_gr, num_groups)) == NULL) { request_error(state); return; @@ -938,7 +943,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state) /* Start sending back groups */ - for (i = 0; i < num_groups; i++) { + for (group_list_ndx = 0; group_list_ndx < num_groups; ) { struct acct_info *name_list = NULL; fstring domain_group_name; uint32 result; |