summaryrefslogtreecommitdiffstats
path: root/source/nsswitch/winbindd_user.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-05-21 21:17:21 +0000
committerGerald Carter <jerry@samba.org>2007-05-21 21:17:21 +0000
commit34059e63c8a644b10cf9a59cca5e67a45053d16e (patch)
treeb0751d47f93023938656df3c6173618dfef4f1e5 /source/nsswitch/winbindd_user.c
parentc3f0e56c057f6be60bd3721485f013ed63defa6a (diff)
downloadsamba-34059e63c8a644b10cf9a59cca5e67a45053d16e.tar.gz
samba-34059e63c8a644b10cf9a59cca5e67a45053d16e.tar.xz
samba-34059e63c8a644b10cf9a59cca5e67a45053d16e.zip
r23052: sync with SAMBA_3_0_25 and start updating release notes
Diffstat (limited to 'source/nsswitch/winbindd_user.c')
-rw-r--r--source/nsswitch/winbindd_user.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/nsswitch/winbindd_user.c b/source/nsswitch/winbindd_user.c
index ce677198fff..18797772dd4 100644
--- a/source/nsswitch/winbindd_user.c
+++ b/source/nsswitch/winbindd_user.c
@@ -631,7 +631,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
{
struct getent_state *ent;
struct winbindd_pw *user_list;
- int num_users, user_list_ndx = 0, i;
+ int num_users, user_list_ndx;
DEBUG(3, ("[%5lu]: getpwent\n", (unsigned long)state->pid));
@@ -645,6 +645,11 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
/* Allocate space for returning a chunk of users */
num_users = MIN(MAX_GETPWENT_USERS, state->request.data.num_entries);
+
+ if (num_users == 0) {
+ request_error(state);
+ return;
+ }
if ((state->response.extra_data.data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL) {
request_error(state);
@@ -666,7 +671,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
/* Start sending back users */
- for (i = 0; i < num_users; i++) {
+ for (user_list_ndx = 0; user_list_ndx < num_users; ) {
struct getpwent_user *name_list = NULL;
uint32 result;
@@ -709,8 +714,6 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
name_list[ent->sam_entry_index].shell,
&user_list[user_list_ndx]);
- ent->sam_entry_index++;
-
/* Add user to return list */
if (result) {
@@ -723,6 +726,9 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
} else
DEBUG(1, ("could not lookup domain user %s\n",
name_list[ent->sam_entry_index].name));
+
+ ent->sam_entry_index++;
+
}
/* Out of domains */