summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-09-19 22:11:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:54 -0500
commit6f5869461cb0a1ac0bdba931a7f7469503154ce3 (patch)
tree275860ac2a3f799645b2a9f030582e4e55ae501b /source3
parent725cbf6cc67ded9d1a68e2ef946cba22e613e199 (diff)
downloadsamba-6f5869461cb0a1ac0bdba931a7f7469503154ce3.tar.gz
samba-6f5869461cb0a1ac0bdba931a7f7469503154ce3.tar.bz2
samba-6f5869461cb0a1ac0bdba931a7f7469503154ce3.zip
r25247: Rename the rpccli_lsa_lookup_sids_all() function to rpccli_lsa_lookup_sids()
and remove the old rpccli_lsa_lookup_sids() function. The old function would fail due to server limits when requesting to resolve too many sids at once (20480 for W2k3). The new version passes the list of sids in hunks to the server. It has up to now been used (and tested) in the winbindd_ads lookup_groupmem() function, and I think the time has come to replace the actual function with this correct version. Michael (This used to be commit 1194d4f36ef720747e62dde31881c295e44e4a76)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_lsarpc.c132
-rw-r--r--source3/winbindd/winbindd_ads.c14
2 files changed, 19 insertions, 127 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 0f66f14288..1af31228da 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -244,14 +244,14 @@ done:
* at 20480 for win2k3, but we keep it at a save 1000 for now. */
#define LOOKUP_SIDS_HUNK_SIZE 1000
-NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- POLICY_HND *pol,
- int num_sids,
- const DOM_SID *sids,
- char ***domains,
- char ***names,
- enum lsa_SidType **types)
+NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol,
+ int num_sids,
+ const DOM_SID *sids,
+ char ***domains,
+ char ***names,
+ enum lsa_SidType **types)
{
NTSTATUS result = NT_STATUS_OK;
int sids_left = 0;
@@ -263,19 +263,19 @@ NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli,
if (num_sids) {
if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
- DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+ DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
- DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+ DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
- DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+ DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
@@ -298,7 +298,7 @@ NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli,
? LOOKUP_SIDS_HUNK_SIZE
: sids_left);
- DEBUG(10, ("rpccli_lsa_lookup_sids_all: processing items "
+ DEBUG(10, ("rpccli_lsa_lookup_sids: processing items "
"%d -- %d of %d.\n",
sids_processed,
sids_processed + hunk_num_sids - 1,
@@ -349,114 +349,6 @@ fail:
return result;
}
-/** Lookup a list of sids */
-
-NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, int num_sids,
- const DOM_SID *sids,
- char ***domains,
- char ***names,
- enum lsa_SidType **types)
-{
- prs_struct qbuf, rbuf;
- LSA_Q_LOOKUP_SIDS q;
- LSA_R_LOOKUP_SIDS r;
- DOM_R_REF ref;
- NTSTATUS result = NT_STATUS_OK;
- int i;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- init_q_lookup_sids(mem_ctx, &q, pol, num_sids, sids, 1);
-
- ZERO_STRUCT(ref);
-
- r.dom_ref = &ref;
-
- CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_LOOKUPSIDS,
- q, r,
- qbuf, rbuf,
- lsa_io_q_lookup_sids,
- lsa_io_r_lookup_sids,
- NT_STATUS_UNSUCCESSFUL );
-
- if (!NT_STATUS_IS_OK(r.status) &&
- !NT_STATUS_EQUAL(r.status, STATUS_SOME_UNMAPPED)) {
-
- /* An actual error occured */
- result = r.status;
-
- goto done;
- }
-
- /* Return output parameters */
-
- if (r.mapped_count == 0) {
- result = NT_STATUS_NONE_MAPPED;
- goto done;
- }
-
- if (num_sids) {
- if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
- DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
- result = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
- DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
- result = NT_STATUS_NO_MEMORY;
- goto done;
- }
-
- if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
- DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
- result = NT_STATUS_NO_MEMORY;
- goto done;
- }
- } else {
- (*domains) = NULL;
- (*names) = NULL;
- (*types) = NULL;
- }
-
- for (i = 0; i < num_sids; i++) {
- fstring name, dom_name;
- uint32 dom_idx = r.names.name[i].domain_idx;
-
- /* Translate optimised name through domain index array */
-
- if (dom_idx != 0xffffffff) {
-
- rpcstr_pull_unistr2_fstring(
- dom_name, &ref.ref_dom[dom_idx].uni_dom_name);
- rpcstr_pull_unistr2_fstring(
- name, &r.names.uni_name[i]);
-
- (*names)[i] = talloc_strdup(mem_ctx, name);
- (*domains)[i] = talloc_strdup(mem_ctx, dom_name);
- (*types)[i] = (enum lsa_SidType)r.names.name[i].sid_name_use;
-
- if (((*names)[i] == NULL) || ((*domains)[i] == NULL)) {
- DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- } else {
- (*names)[i] = NULL;
- (*domains)[i] = NULL;
- (*types)[i] = SID_NAME_UNKNOWN;
- }
- }
-
- done:
-
- return result;
-}
-
/** Lookup a list of names */
NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 65cc00bb97..488967ed09 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -1049,13 +1049,13 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
goto done;
}
- status = rpccli_lsa_lookup_sids_all(cli, tmp_ctx,
- &lsa_policy,
- num_nocache,
- sid_mem_nocache,
- &domains_nocache,
- &names_nocache,
- &name_types_nocache);
+ status = rpccli_lsa_lookup_sids(cli, tmp_ctx,
+ &lsa_policy,
+ num_nocache,
+ sid_mem_nocache,
+ &domains_nocache,
+ &names_nocache,
+ &name_types_nocache);
if (NT_STATUS_IS_OK(status) ||
NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED))