summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/lsa/lsa_lookup.c102
1 files changed, 53 insertions, 49 deletions
diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c
index 522d2db6d6..4b2a37a210 100644
--- a/source4/rpc_server/lsa/lsa_lookup.c
+++ b/source4/rpc_server/lsa/lsa_lookup.c
@@ -750,29 +750,20 @@ NTSTATUS dcesrv_lsa_LookupSids(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
return status;
}
-
-/*
- lsa_LookupNames3
-*/
-NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
- TALLOC_CTX *mem_ctx,
- struct lsa_LookupNames3 *r)
+static NTSTATUS dcesrv_lsa_LookupNames_common(struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
+ struct lsa_policy_state *policy_state,
+ struct lsa_LookupNames3 *r)
{
- struct lsa_policy_state *policy_state;
- struct dcesrv_handle *policy_handle;
- uint32_t i;
struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
struct lsa_RefDomainList *domains;
-
- DCESRV_PULL_HANDLE(policy_handle, r->in.handle, LSA_HANDLE_POLICY);
+ uint32_t i;
if (r->in.level < LSA_LOOKUP_NAMES_ALL ||
r->in.level > LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC) {
return NT_STATUS_INVALID_PARAMETER;
}
- policy_state = policy_handle->data;
-
*r->out.domains = NULL;
domains = talloc_zero(mem_ctx, struct lsa_RefDomainList);
@@ -839,6 +830,26 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
return NT_STATUS_OK;
}
+/*
+ lsa_LookupNames3
+*/
+NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
+ struct lsa_LookupNames3 *r)
+{
+ struct lsa_policy_state *policy_state;
+ struct dcesrv_handle *policy_handle;
+
+ DCESRV_PULL_HANDLE(policy_handle, r->in.handle, LSA_HANDLE_POLICY);
+
+ policy_state = policy_handle->data;
+
+ return dcesrv_lsa_LookupNames_common(dce_call,
+ mem_ctx,
+ policy_state,
+ r);
+}
+
/*
lsa_LookupNames4
@@ -848,48 +859,41 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
NTSTATUS dcesrv_lsa_LookupNames4(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct lsa_LookupNames4 *r)
{
- struct lsa_LookupNames3 r2;
- struct lsa_OpenPolicy2 pol;
+ struct lsa_policy_state *policy_state;
+ struct lsa_LookupNames3 q;
NTSTATUS status;
- struct dcesrv_handle *h;
-
- ZERO_STRUCT(r2);
-
- /* No policy handle on the wire, so make one up here */
- r2.in.handle = talloc(mem_ctx, struct policy_handle);
- if (!r2.in.handle) {
- return NT_STATUS_NO_MEMORY;
- }
- pol.out.handle = r2.in.handle;
- pol.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- pol.in.attr = NULL;
- pol.in.system_name = NULL;
- status = dcesrv_lsa_OpenPolicy2(dce_call, mem_ctx, &pol);
+ status = dcesrv_lsa_get_policy_state(dce_call, mem_ctx, &policy_state);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- /* ensure this handle goes away at the end of this call */
- DCESRV_PULL_HANDLE(h, r2.in.handle, LSA_HANDLE_POLICY);
- talloc_steal(mem_ctx, h);
+ ZERO_STRUCT(q);
+
+ q.in.handle = NULL;
+ q.in.num_names = r->in.num_names;
+ q.in.names = r->in.names;
+ q.in.level = r->in.level;
+ q.in.sids = r->in.sids;
+ q.in.count = r->in.count;
+ q.in.lookup_options = r->in.lookup_options;
+ q.in.client_revision = r->in.client_revision;
+
+ q.out.count = r->out.count;
+ q.out.sids = r->out.sids;
+ q.out.domains = r->out.domains;
+
+ status = dcesrv_lsa_LookupNames_common(dce_call,
+ mem_ctx,
+ policy_state,
+ &q);
+
+ talloc_free(policy_state);
+
+ r->out.count = q.out.count;
+ r->out.sids = q.out.sids;
+ r->out.domains = q.out.domains;
- r2.in.num_names = r->in.num_names;
- r2.in.names = r->in.names;
- r2.in.level = r->in.level;
- r2.in.sids = r->in.sids;
- r2.in.count = r->in.count;
- r2.in.lookup_options = r->in.lookup_options;
- r2.in.client_revision = r->in.client_revision;
- r2.out.domains = r->out.domains;
- r2.out.sids = r->out.sids;
- r2.out.count = r->out.count;
-
- status = dcesrv_lsa_LookupNames3(dce_call, mem_ctx, &r2);
-
- r->out.domains = r2.out.domains;
- r->out.sids = r2.out.sids;
- r->out.count = r2.out.count;
return status;
}