[PATCH 11/22] winbindd: Do not segfault if the trusted domain has no SID

abartlet at samba.org abartlet at samba.org
Tue Aug 19 20:06:46 MDT 2014


From: Andrew Bartlett <abartlet at samba.org>

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 <abartlet at samba.org>
---
 source3/winbindd/winbindd_rpc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index 85b3d5c..7a80237 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);
 			}
 
-- 
2.0.1



More information about the samba-technical mailing list