From d1730d6ff19b60ebf9f6b18aaa4afab733b18b25 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Tue, 27 Mar 2018 12:19:31 +1300 Subject: [PATCH] netlogon: Allow zero-GUID to act the same as NULL in GetDCNameEx2 This matches Windows behaviour and allows rpcclient to work against Samba without knowing the GUID ahead of time. Errors related to this don't appear to occur within selftest. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13365 Signed-off-by: Garming Sam Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett Autobuild-User(master): Garming Sam Autobuild-Date(master): Fri May 4 09:11:19 CEST 2018 on sn-devel-144 --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index d497364ea0d..638dfc2b13a 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -2845,6 +2845,14 @@ static WERROR dcesrv_netr_DsRGetDCName_base_call(struct dcesrv_netr_DsRGetDCName return WERR_INVALID_FLAGS; } + /* + * If we send an all-zero GUID, we should ignore it as winbind actually + * checks it with a DNS query. Windows also appears to ignore it. + */ + if (r->in.domain_guid != NULL && GUID_all_zero(r->in.domain_guid)) { + r->in.domain_guid = NULL; + } + /* Attempt winbind search only if we suspect the domain is incorrect */ if (r->in.domain_name != NULL && strcmp("", r->in.domain_name) != 0) { if (r->in.flags & DS_IS_FLAT_NAME) {