summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/util/clilsa.c4
-rw-r--r--source4/libnet/libnet_lookup.c4
-rw-r--r--source4/librpc/idl/lsa.idl24
-rw-r--r--source4/rpc_server/lsa/lsa_lookup.c22
-rw-r--r--source4/torture/ndr/lsa.c9
-rw-r--r--source4/torture/rpc/lsa.c10
-rw-r--r--source4/torture/rpc/samba3rpc.c4
-rw-r--r--source4/winbind/wb_async_helpers.c10
8 files changed, 57 insertions, 30 deletions
diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c
index 3d33941a1f..16967d73b0 100644
--- a/source4/libcli/util/clilsa.c
+++ b/source4/libcli/util/clilsa.c
@@ -264,6 +264,7 @@ NTSTATUS smblsa_lookup_name(struct smbcli_state *cli,
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
struct lsa_String names;
+ struct lsa_RefDomainList *domains = NULL;
uint32_t count = 1;
NTSTATUS status;
struct dom_sid *sid;
@@ -288,6 +289,7 @@ NTSTATUS smblsa_lookup_name(struct smbcli_state *cli,
r.in.count = &count;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames(cli->lsa->pipe, mem_ctx2, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -299,7 +301,7 @@ NTSTATUS smblsa_lookup_name(struct smbcli_state *cli,
return NT_STATUS_UNSUCCESSFUL;
}
- sid = r.out.domains->domains[0].sid;
+ sid = domains->domains[0].sid;
rid = sids.sids[0].rid;
(*sid_str) = talloc_asprintf(mem_ctx, "%s-%u",
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index dc54ec3cf1..fc307823b8 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -312,6 +312,8 @@ static bool prepare_lookup_params(struct libnet_context *ctx,
s->lookup.in.count = &s->count;
s->lookup.out.count = &s->count;
s->lookup.out.sids = &s->sids;
+ s->lookup.out.domains = talloc_zero(ctx, struct lsa_RefDomainList *);
+ if (composite_nomem(s->lookup.out.domains, c)) return false;
return true;
}
@@ -372,7 +374,7 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx
io->out.sidstr = NULL;
if (*s->lookup.out.count > 0) {
- struct lsa_RefDomainList *domains = s->lookup.out.domains;
+ struct lsa_RefDomainList *domains = *s->lookup.out.domains;
struct lsa_TransSidArray *sids = s->lookup.out.sids;
if (domains == NULL || sids == NULL) {
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl
index f3bfb8b359..a4d5aa964c 100644
--- a/source4/librpc/idl/lsa.idl
+++ b/source4/librpc/idl/lsa.idl
@@ -419,10 +419,10 @@ import "misc.idl", "security.idl";
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
- [out,unique] lsa_RefDomainList *domains,
- [in,out] lsa_TransSidArray *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray *sids,
[in] lsa_LookupNamesLevel level,
- [in,out] uint32 *count
+ [in,out,ref] uint32 *count
);
@@ -1041,10 +1041,10 @@ import "misc.idl", "security.idl";
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
- [out,unique] lsa_RefDomainList *domains,
- [in,out] lsa_TransSidArray2 *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray2 *sids,
[in] lsa_LookupNamesLevel level,
- [in,out] uint32 *count,
+ [in,out,ref] uint32 *count,
[in] uint32 lookup_options,
[in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
@@ -1100,10 +1100,10 @@ import "misc.idl", "security.idl";
[in] policy_handle *handle,
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
- [out,unique] lsa_RefDomainList *domains,
- [in,out] lsa_TransSidArray3 *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray3 *sids,
[in] lsa_LookupNamesLevel level,
- [in,out] uint32 *count,
+ [in,out,ref] uint32 *count,
[in] uint32 lookup_options,
[in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
@@ -1193,10 +1193,10 @@ import "misc.idl", "security.idl";
NTSTATUS lsa_LookupNames4(
[in,range(0,1000)] uint32 num_names,
[in,size_is(num_names)] lsa_String names[],
- [out,unique] lsa_RefDomainList *domains,
- [in,out] lsa_TransSidArray3 *sids,
+ [out,ref] lsa_RefDomainList **domains,
+ [in,out,ref] lsa_TransSidArray3 *sids,
[in] lsa_LookupNamesLevel level,
- [in,out] uint32 *count,
+ [in,out,ref] uint32 *count,
[in] uint32 lookup_options,
[in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c
index e6285365ca..a56e7764a9 100644
--- a/source4/rpc_server/lsa/lsa_lookup.c
+++ b/source4/rpc_server/lsa/lsa_lookup.c
@@ -738,6 +738,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
struct dcesrv_handle *policy_handle;
int 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);
@@ -748,12 +749,13 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
policy_state = policy_handle->data;
- r->out.domains = NULL;
+ *r->out.domains = NULL;
- r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList);
- if (r->out.domains == NULL) {
+ domains = talloc_zero(mem_ctx, struct lsa_RefDomainList);
+ if (domains == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ *r->out.domains = domains;
r->out.sids = talloc_zero(mem_ctx, struct lsa_TransSidArray3);
if (r->out.sids == NULL) {
@@ -789,7 +791,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
}
status2 = dcesrv_lsa_authority_list(policy_state, mem_ctx, rtype, authority_name,
- sid, r->out.domains, &sid_index);
+ sid, domains, &sid_index);
if (!NT_STATUS_IS_OK(status2)) {
continue;
}
@@ -877,8 +879,9 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
struct dcesrv_handle *h;
int i;
struct loadparm_context *lp_ctx = dce_call->conn->dce_ctx->lp_ctx;
+ struct lsa_RefDomainList *domains;
- r->out.domains = NULL;
+ *r->out.domains = NULL;
DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY);
@@ -889,10 +892,11 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
state = h->data;
- r->out.domains = talloc_zero(mem_ctx, struct lsa_RefDomainList);
- if (r->out.domains == NULL) {
+ domains = talloc_zero(mem_ctx, struct lsa_RefDomainList);
+ if (domains == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ *r->out.domains = domains;
r->out.sids = talloc_zero(mem_ctx, struct lsa_TransSidArray2);
if (r->out.sids == NULL) {
@@ -931,7 +935,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
}
status2 = dcesrv_lsa_authority_list(state, mem_ctx, rtype, authority_name,
- sid, r->out.domains, &sid_index);
+ sid, domains, &sid_index);
if (!NT_STATUS_IS_OK(status2)) {
continue;
}
@@ -975,13 +979,13 @@ NTSTATUS dcesrv_lsa_LookupNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *
r2.in.lookup_options = 0;
r2.in.client_revision = 0;
r2.out.count = r->out.count;
+ r2.out.domains = r->out.domains;
status = dcesrv_lsa_LookupNames2(dce_call, mem_ctx, &r2);
if (r2.out.sids == NULL) {
return status;
}
- r->out.domains = r2.out.domains;
r->out.sids = talloc(mem_ctx, struct lsa_TransSidArray);
if (r->out.sids == NULL) {
return NT_STATUS_NO_MEMORY;
diff --git a/source4/torture/ndr/lsa.c b/source4/torture/ndr/lsa.c
index 6f580bd8d8..68eb36ebbd 100644
--- a/source4/torture/ndr/lsa.c
+++ b/source4/torture/ndr/lsa.c
@@ -428,11 +428,12 @@ static const uint8_t lsarlookupnames_out_data[] = {
static bool lsarlookupnames_out_check(struct torture_context *tctx,
struct lsa_LookupNames *r)
{
+ struct lsa_RefDomainList *domains = *(r->out.domains);
torture_assert(tctx, r->out.domains != NULL, "domains ptr");
- torture_assert_int_equal(tctx, r->out.domains->count, 1, "domains count");
- torture_assert_int_equal(tctx, r->out.domains->max_size, 32, "domains size");
- torture_assert(tctx, r->out.domains->domains != NULL, "domains domains");
- torture_assert_str_equal(tctx, r->out.domains->domains[0].name.string, "BUILTIN", "domain name");
+ torture_assert_int_equal(tctx, domains->count, 1, "domains count");
+ torture_assert_int_equal(tctx, domains->max_size, 32, "domains size");
+ torture_assert(tctx, domains->domains != NULL, "domains domains");
+ torture_assert_str_equal(tctx, domains->domains[0].name.string, "BUILTIN", "domain name");
/* FIXME: SID */
torture_assert(tctx, r->out.count != NULL, "count ptr");
torture_assert_int_equal(tctx, *r->out.count, 100, "count");
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index ea9435bd95..a4dd2e13dd 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -153,6 +153,7 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
{
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
@@ -176,6 +177,7 @@ static bool test_LookupNames(struct dcerpc_pipe *p,
r.in.count = &count;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
@@ -217,6 +219,7 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
{
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
@@ -248,6 +251,7 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
r.in.count = &count;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames(p, mem_ctx, &r);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
@@ -317,6 +321,7 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
{
struct lsa_LookupNames2 r;
struct lsa_TransSidArray2 sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
@@ -342,6 +347,7 @@ static bool test_LookupNames2(struct dcerpc_pipe *p,
r.in.client_revision = 0;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -362,6 +368,7 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
{
struct lsa_LookupNames3 r;
struct lsa_TransSidArray3 sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
@@ -387,6 +394,7 @@ static bool test_LookupNames3(struct dcerpc_pipe *p,
r.in.client_revision = 0;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames3(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -405,6 +413,7 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
{
struct lsa_LookupNames4 r;
struct lsa_TransSidArray3 sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String *names;
uint32_t count = 0;
NTSTATUS status;
@@ -429,6 +438,7 @@ static bool test_LookupNames4(struct dcerpc_pipe *p,
r.in.client_revision = 0;
r.out.count = &count;
r.out.sids = &sids;
+ r.out.domains = &domains;
status = dcerpc_lsa_LookupNames4(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 25cbb6727d..dc904fccf1 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -1500,6 +1500,7 @@ static struct dom_sid *name2sid(TALLOC_CTX *mem_ctx,
struct policy_handle handle;
struct lsa_LookupNames l;
struct lsa_TransSidArray sids;
+ struct lsa_RefDomainList *domains = NULL;
struct lsa_String lsa_name;
uint32_t count = 0;
struct dom_sid *result;
@@ -1546,6 +1547,7 @@ static struct dom_sid *name2sid(TALLOC_CTX *mem_ctx,
l.in.count = &count;
l.out.count = &count;
l.out.sids = &sids;
+ l.out.domains = &domains;
status = dcerpc_lsa_LookupNames(p, tmp_ctx, &l);
if (!NT_STATUS_IS_OK(status)) {
@@ -1555,7 +1557,7 @@ static struct dom_sid *name2sid(TALLOC_CTX *mem_ctx,
return NULL;
}
- result = dom_sid_add_rid(mem_ctx, l.out.domains->domains[0].sid,
+ result = dom_sid_add_rid(mem_ctx, domains->domains[0].sid,
l.out.sids->sids[0].rid);
c.in.handle = &handle;
diff --git a/source4/winbind/wb_async_helpers.c b/source4/winbind/wb_async_helpers.c
index b9c37ca588..48a2a4d882 100644
--- a/source4/winbind/wb_async_helpers.c
+++ b/source4/winbind/wb_async_helpers.c
@@ -190,6 +190,7 @@ struct lsa_lookupnames_state {
uint32_t num_names;
struct lsa_LookupNames r;
struct lsa_TransSidArray sids;
+ struct lsa_RefDomainList *domains;
uint32_t count;
struct wb_sid_object **result;
};
@@ -229,6 +230,9 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx,
lsa_names[i].string = names[i];
}
+ state->domains = talloc(state, struct lsa_RefDomainList);
+ if (state->domains == NULL) goto failed;
+
state->r.in.handle = handle;
state->r.in.num_names = num_names;
state->r.in.names = lsa_names;
@@ -237,6 +241,7 @@ struct composite_context *wb_lsa_lookupnames_send(TALLOC_CTX *mem_ctx,
state->r.in.count = &state->count;
state->r.out.count = &state->count;
state->r.out.sids = &state->sids;
+ state->r.out.domains = &state->domains;
req = dcerpc_lsa_LookupNames_send(lsa_pipe, state, &state->r);
if (req == NULL) goto failed;
@@ -272,6 +277,7 @@ static void lsa_lookupnames_recv_sids(struct rpc_request *req)
for (i=0; i<state->num_names; i++) {
struct lsa_TranslatedSid *sid = &state->r.out.sids->sids[i];
+ struct lsa_RefDomainList *domains = state->domains;
struct lsa_DomainInfo *dom;
state->result[i] = talloc_zero(state->result,
@@ -283,13 +289,13 @@ static void lsa_lookupnames_recv_sids(struct rpc_request *req)
continue;
}
- if (sid->sid_index >= state->r.out.domains->count) {
+ if (sid->sid_index >= domains->count) {
composite_error(state->ctx,
NT_STATUS_INVALID_PARAMETER);
return;
}
- dom = &state->r.out.domains->domains[sid->sid_index];
+ dom = &domains->domains[sid->sid_index];
state->result[i]->sid = dom_sid_add_rid(state->result[i],
dom->sid, sid->rid);