summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-02-26 00:52:41 +0000
committerTim Potter <tpot@samba.org>2003-02-26 00:52:41 +0000
commitb906a9df75b6bdc6fe166e9aa5a8aa398176a518 (patch)
tree9be234966540b0e426be361a8ef5fbc68078c240 /source3/nsswitch
parentf9d577ac099974f58522c1c5c42e5804a62c8e0b (diff)
downloadsamba-b906a9df75b6bdc6fe166e9aa5a8aa398176a518.tar.gz
samba-b906a9df75b6bdc6fe166e9aa5a8aa398176a518.tar.bz2
samba-b906a9df75b6bdc6fe166e9aa5a8aa398176a518.zip
Merge from appliance:
>Another hopeful fix for CR#1168. Change the RPC used in querying >domain users from QueryDispInfo to EnumDomainUsers. Hopefully this >will fix the random dropouts that keep occuring when listing large >domains. > >My thought is that since QueryDispInfo is only used in the NT user >manager it may have a bug with large domains. A more commonly used >RPC may not have such problems. (This used to be commit 0501b7d0b12fa8063ffe6a9d4ecc3391d0c2f45d)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_rpc.c57
1 files changed, 23 insertions, 34 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index 48f528f520..90d8e4f616 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -3,7 +3,7 @@
Winbind rpc backend functions
- Copyright (C) Tim Potter 2000-2001
+ Copyright (C) Tim Potter 2000-2001,2003
Copyright (C) Andrew Tridgell 2001
This program is free software; you can redistribute it and/or modify
@@ -39,18 +39,17 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
POLICY_HND dom_pol;
BOOL got_dom_pol = False;
uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED;
- int i, loop_count = 0;
- int retry;
+ int i, start_idx, retry;
DEBUG(3,("rpc: query_user_list\n"));
*num_entries = 0;
*info = NULL;
- /* Get sam handle */
-
retry = 0;
do {
+ /* Get sam handle */
+
if (!(hnd = cm_get_sam_handle(domain->name)))
goto done;
@@ -66,50 +65,39 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
got_dom_pol = True;
- i = 0;
+ i = start_idx = 0;
do {
- SAM_DISPINFO_CTR ctr;
- SAM_DISPINFO_1 info1;
- uint32 count = 0, start=i, max_entries, max_size;
- int j;
TALLOC_CTX *ctx2;
+ char **dom_users;
+ uint32 num_dom_users, *dom_rids, j, size = 0xffff;
+ uint16 acb_mask = ACB_NORMAL;
- ctr.sam.info1 = &info1;
-
- ctx2 = talloc_init("winbindd dispinfo");
- if (!ctx2) {
+ if (!(ctx2 = talloc_init("winbindd enum_users"))) {
result = NT_STATUS_NO_MEMORY;
goto done;
- }
-
- get_query_dispinfo_params(
- loop_count, &max_entries, &max_size);
-
- /* Query display info level 1 */
- result = cli_samr_query_dispinfo(
- hnd->cli, ctx2, &dom_pol, &start, 1, &count,
- max_entries, max_size, &ctr);
+ }
- loop_count++;
+ result = cli_samr_enum_dom_users(
+ hnd->cli, ctx2, &dom_pol, &start_idx, acb_mask,
+ size, &dom_users, &dom_rids, &num_dom_users);
- if (!NT_STATUS_IS_OK(result) &&
- !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) break;
+ *num_entries += num_dom_users;
- (*num_entries) += count;
+ *info = talloc_realloc(
+ mem_ctx, *info,
+ (*num_entries) * sizeof(WINBIND_USERINFO));
- /* now map the result into the WINBIND_USERINFO structure */
- (*info) = talloc_realloc(mem_ctx, *info,
- (*num_entries)*sizeof(WINBIND_USERINFO));
if (!(*info)) {
result = NT_STATUS_NO_MEMORY;
talloc_destroy(ctx2);
goto done;
}
- 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 (j = 0; j < num_dom_users; i++, j++) {
+ (*info)[i].acct_name =
+ talloc_strdup(mem_ctx, dom_users[j]);
+ (*info)[i].full_name = talloc_strdup(mem_ctx, "");
+ (*info)[i].user_rid = dom_rids[j];
/* For the moment we set the primary group for
every user to be the Domain Users group.
There are serious problems with determining
@@ -121,6 +109,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
}
talloc_destroy(ctx2);
+
} while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));
done: