summaryrefslogtreecommitdiff
path: root/source4/libnet/libnet_lookup.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-14 08:23:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:17 -0500
commitbdafdec2bbac2b9a63b72c9e26b8d1e98ff6f0b0 (patch)
treeb5ed254240649afda1fd1d2d6d9b65c570e84a59 /source4/libnet/libnet_lookup.c
parent32a0486739e91e45967200c5bacd3f2fd6ec0e57 (diff)
downloadsamba-bdafdec2bbac2b9a63b72c9e26b8d1e98ff6f0b0.tar.gz
samba-bdafdec2bbac2b9a63b72c9e26b8d1e98ff6f0b0.tar.bz2
samba-bdafdec2bbac2b9a63b72c9e26b8d1e98ff6f0b0.zip
r20166: we have a dom_sid_add_rid() function that adds the rid after allocating
enough memory for the new sub_auth element. the old version wrote behind the buffer. also make the output sid a pointer. metze (This used to be commit b9901d5f8c9aa777bafd3a670d27209552bc56b7)
Diffstat (limited to 'source4/libnet/libnet_lookup.c')
-rw-r--r--source4/libnet/libnet_lookup.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index fe5851f271..5e6958543b 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -406,13 +406,12 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx
if (NT_STATUS_IS_OK(status)) {
s = talloc_get_type(c->private_data, struct lookup_name_state);
-
- ZERO_STRUCT(io->out.domain_sid);
+
io->out.rid = 0;
+ io->out.sid = NULL;
io->out.sidstr = NULL;
if (*s->lookup.out.count > 0) {
- int num_auths;
struct lsa_RefDomainList *domains = s->lookup.out.domains;
struct lsa_TransSidArray *sids = s->lookup.out.sids;
@@ -421,14 +420,12 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx
if (sids->count > 0) {
io->out.rid = sids->sids[0].rid;
io->out.sid_type = sids->sids[0].sid_type;
- }
-
- if (domains->count > 0) {
- io->out.domain_sid = *domains->domains[0].sid;
- num_auths = io->out.domain_sid.num_auths++;
- io->out.domain_sid.sub_auths[num_auths] = io->out.rid;
-
- io->out.sidstr = dom_sid_string(mem_ctx, &io->out.domain_sid);
+ if (domains->count > 0) {
+ io->out.sid = dom_sid_add_rid(mem_ctx, domains->domains[0].sid, io->out.rid);
+ NT_STATUS_HAVE_NO_MEMORY(io->out.sid);
+ io->out.sidstr = dom_sid_string(mem_ctx, io->out.sid);
+ NT_STATUS_HAVE_NO_MEMORY(io->out.sidstr);
+ }
}
}
@@ -438,6 +435,7 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx
io->out.error_string = talloc_asprintf(mem_ctx, "Error: %s", nt_errstr(status));
}
+ talloc_free(c);
return status;
}