netlogon: Allow zero-GUID to act the same as NULL in GetDCNameEx2
authorGarming Sam <garming@catalyst.net.nz>
Mon, 26 Mar 2018 23:19:31 +0000 (12:19 +1300)
committerGarming Sam <garming@samba.org>
Fri, 4 May 2018 07:11:19 +0000 (09:11 +0200)
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 <garming@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Fri May  4 09:11:19 CEST 2018 on sn-devel-144

source4/rpc_server/netlogon/dcerpc_netlogon.c

index d497364..638dfc2 100644 (file)
@@ -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) {