This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
/* Get rid and name type from name. The following costs 1 packet */
winbindd_lookupname_async(state->mem_ctx, domname, username,
- getpwnam_name2sid_recv, state);
+ getpwnam_name2sid_recv, WINBINDD_GETPWNAM,
+ state);
}
static void getpwnam_name2sid_recv(void *private_data, BOOL success,
{
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));
/* 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);
/* 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;
name_list[ent->sam_entry_index].shell,
&user_list[user_list_ndx]);
- ent->sam_entry_index++;
-
/* Add user to return list */
if (result) {
} else
DEBUG(1, ("could not lookup domain user %s\n",
name_list[ent->sam_entry_index].name));
+
+ ent->sam_entry_index++;
+
}
/* Out of domains */