diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-12-14 08:23:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:29:17 -0500 |
commit | bdafdec2bbac2b9a63b72c9e26b8d1e98ff6f0b0 (patch) | |
tree | b5ed254240649afda1fd1d2d6d9b65c570e84a59 | |
parent | 32a0486739e91e45967200c5bacd3f2fd6ec0e57 (diff) | |
download | samba-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)
-rw-r--r-- | source4/libnet/libnet_lookup.c | 20 | ||||
-rw-r--r-- | source4/libnet/libnet_lookup.h | 2 |
2 files changed, 10 insertions, 12 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; } diff --git a/source4/libnet/libnet_lookup.h b/source4/libnet/libnet_lookup.h index 52af03bf27..5f1a2c3940 100644 --- a/source4/libnet/libnet_lookup.h +++ b/source4/libnet/libnet_lookup.h @@ -49,7 +49,7 @@ struct libnet_LookupName { const char *domain_name; } in; struct { - struct dom_sid domain_sid; + struct dom_sid *sid; int rid; enum lsa_SidType sid_type; const char *sidstr; |