diff options
-rw-r--r-- | source4/libnet/libnet_lookup.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index b5b8080433..fe5851f271 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -418,14 +418,18 @@ NTSTATUS libnet_LookupName_recv(struct composite_context *c, TALLOC_CTX *mem_ctx /* TODO: verify if returned pointers are non-null */ - io->out.domain_sid = *domains->domains[0].sid; - io->out.rid = sids->sids[0].rid; - io->out.sid_type = sids->sids[0].sid_type; - - 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 (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); + } } io->out.error_string = talloc_strdup(mem_ctx, "Success"); |