summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_rpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-11 00:03:58 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-11 00:03:58 +0000
commitabeb0f50ea3e7ac254aa8746e074f118fdb62db1 (patch)
tree60a7f16a18c1100ee0eb21df12851fc0123beb27 /source3/nsswitch/winbindd_rpc.c
parentbf5a0e6717f786d4f623e3cca9f846a9413f82d5 (diff)
downloadsamba-abeb0f50ea3e7ac254aa8746e074f118fdb62db1.tar.gz
samba-abeb0f50ea3e7ac254aa8746e074f118fdb62db1.tar.bz2
samba-abeb0f50ea3e7ac254aa8746e074f118fdb62db1.zip
got rid of start_ndx from query_user_list()
(This used to be commit 1c909afe76566807fb576c965eb869f98e72f2bd)
Diffstat (limited to 'source3/nsswitch/winbindd_rpc.c')
-rw-r--r--source3/nsswitch/winbindd_rpc.c62
1 files changed, 39 insertions, 23 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index 5417e8c4d0..eb14a30f39 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -28,7 +28,7 @@
application. */
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
- uint32 *start_ndx, uint32 *num_entries,
+ uint32 *num_entries,
WINBIND_USERINFO **info)
{
CLI_POLICY_HND *hnd;
@@ -41,6 +41,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
int i;
*num_entries = 0;
+ *info = NULL;
/* Get sam handle */
@@ -59,28 +60,43 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
ctr.sam.info1 = &info1;
- /* Query display info level 1 */
- result = cli_samr_query_dispinfo(hnd->cli, mem_ctx,
- &dom_pol, start_ndx, 1,
- num_entries, 0xffff, &ctr);
-
- /* now map the result into the WINBIND_USERINFO structure */
- (*info) = (WINBIND_USERINFO *)talloc(mem_ctx, (*num_entries)*sizeof(WINBIND_USERINFO));
- if (!(*info)) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0;i<*num_entries;i++) {
- (*info)[i].acct_name = unistr2_tdup(mem_ctx, &info1.str[i].uni_acct_name);
- (*info)[i].full_name = unistr2_tdup(mem_ctx, &info1.str[i].uni_full_name);
- (*info)[i].user_rid = info1.sam[i].rid_user;
- /* For the moment we set the primary group for every user to be the
- Domain Users group. There are serious problems with determining
- the actual primary group for large domains. This should really
- be made into a 'winbind force group' smb.conf parameter or
- something like that. */
- (*info)[i].group_rid = DOMAIN_GROUP_RID_USERS;
- }
+ i = 0;
+ do {
+ uint32 count = 0, start=i;
+ int j;
+
+
+ /* Query display info level 1 */
+ result = cli_samr_query_dispinfo(hnd->cli, mem_ctx,
+ &dom_pol, &start, 1,
+ &count, 0xFFFF, &ctr);
+
+ if (!NT_STATUS_IS_OK(result) &&
+ !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) break;
+
+ (*num_entries) += count;
+
+ /* now map the result into the WINBIND_USERINFO structure */
+ (*info) = talloc_realloc(mem_ctx, *info,
+ (*num_entries)*sizeof(WINBIND_USERINFO));
+ if (!(*info)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ for (j=0;j<count;i++, j++) {
+ (*info)[i].acct_name = unistr2_tdup(mem_ctx, &info1.str[j].uni_acct_name);
+ (*info)[i].full_name = unistr2_tdup(mem_ctx, &info1.str[j].uni_full_name);
+ (*info)[i].user_rid = info1.sam[j].rid_user;
+ /* For the moment we set the primary group for
+ every user to be the Domain Users group.
+ There are serious problems with determining
+ the actual primary group for large domains.
+ This should really be made into a 'winbind
+ force group' smb.conf parameter or
+ something like that. */
+ (*info)[i].group_rid = DOMAIN_GROUP_RID_USERS;
+ }
+ } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));
done: