diff options
author | Rafal Szczesniak <mimir@samba.org> | 2006-12-13 23:35:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:29:16 -0500 |
commit | 1dd09da39210d180bfd5a0df8b999f2fe82879f0 (patch) | |
tree | d0dd7c6edba954428c77c6b679e242253124c8e0 | |
parent | bddd8ed5c4cf13305bc42b3873b731a7b011010d (diff) | |
download | samba-1dd09da39210d180bfd5a0df8b999f2fe82879f0.tar.gz samba-1dd09da39210d180bfd5a0df8b999f2fe82879f0.tar.bz2 samba-1dd09da39210d180bfd5a0df8b999f2fe82879f0.zip |
r20161: Prevent potential segfault in case account is unknown.
rafal
(This used to be commit 9f5f9ee9b4b815715c0b580e21ab0906fa15ae96)
-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"); |