From: Andrew Bartlett Date: Sun, 10 Aug 2014 23:47:54 +0000 (+1200) Subject: winbindd: Do not segfault if the trusted domain has no SID X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=a348959088348560fe31fdc73b8482214c4021bf;p=obnox%2Fsamba%2Fsamba-obnox.git winbindd: Do not segfault if the trusted domain has no SID Currently we abort, as skipping the domain would make the loop much more complex for a situation not yet seen in the real world. Andrew Bartlett Change-Id: Ie1e269eb25047d662d8fd0f771ee20de1d48706b Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher Reviewed-By: Jelmer Vernooij --- diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index 85b3d5c08e5..7a80237e692 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -1041,13 +1041,21 @@ NTSTATUS rpc_trusted_domains(TALLOC_CTX *mem_ctx, &dom_list_ex.domains[i].netbios_name.string); trust->dns_name = talloc_move(array, &dom_list_ex.domains[i].domain_name.string); - + if (dom_list_ex.domains[i].sid == NULL) { + DEBUG(0, ("Trusted Domain %s has no SID, aborting!\n", trust->dns_name)); + return NT_STATUS_INVALID_NETWORK_RESPONSE; + } sid_copy(sid, dom_list_ex.domains[i].sid); } else { trust->netbios_name = talloc_move(array, &dom_list.domains[i].name.string); trust->dns_name = NULL; + if (dom_list.domains[i].sid == NULL) { + DEBUG(0, ("Trusted Domain %s has no SID, aborting!\n", trust->netbios_name)); + return NT_STATUS_INVALID_NETWORK_RESPONSE; + } + sid_copy(sid, dom_list.domains[i].sid); }