s4:netlogon RPC server - DsRGetDcNameEx - set the DNS name flags correctly
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 23 Nov 2011 19:32:57 +0000 (20:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Sun, 27 Nov 2011 11:51:54 +0000 (12:51 +0100)
The rules are explained in MS-NRPC 2.2.1.2.1.

Patch inspired by Matthieu Patou.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/cldap_server/netlogon.c
source4/rpc_server/netlogon/dcerpc_netlogon.c

index 0c4abebf8354a0da73d386325e0650e2b34ecf7d..9d9f45e8bb0279d200884019c0a4a2ade893082f 100644 (file)
@@ -226,11 +226,6 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
                DS_SERVER_DS | DS_SERVER_TIMESERV |
                DS_SERVER_GOOD_TIMESERV;
 
-#if 0
-       /* w2k8-r2 as a DC does not claim these */
-       server_type |= DS_DNS_CONTROLLER | DS_DNS_DOMAIN;
-#endif
-
        if (samdb_is_pdc(sam_ctx)) {
                server_type |= DS_SERVER_PDC;
        }
@@ -255,13 +250,6 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
                server_type |= DS_SERVER_WRITABLE;
        }
 
-#if 0
-       /* w2k8-r2 as a sole DC does not claim this */
-       if (ldb_dn_compare(ldb_get_root_basedn(sam_ctx), ldb_get_default_basedn(sam_ctx)) == 0) {
-               server_type |= DS_DNS_FOREST_ROOT;
-       }
-#endif
-
        pdc_name         = talloc_asprintf(mem_ctx, "\\\\%s",
                                           lpcfg_netbios_name(lp_ctx));
        NT_STATUS_HAVE_NO_MEMORY(pdc_name);
index 814b9699ed4813c4fd897eeb453776f0a9d9da0a..125fb3859eb60e4811620316001cd4921fa4af43 100644 (file)
@@ -1791,9 +1791,23 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call,
                return ntstatus_to_werror(status);
        }
 
+       /*
+        * According to MS-NRPC 2.2.1.2.1 we should set the "DS_DNS_FOREST_ROOT"
+        * (O) flag when the returned forest name is in DNS format. This is here
+        * always the case (see below).
+        */
+       response.data.nt5_ex.server_type |= DS_DNS_FOREST_ROOT;
+
        if (r->in.flags & DS_RETURN_DNS_NAME) {
                dc_name = response.data.nt5_ex.pdc_dns_name;
                domain_name = response.data.nt5_ex.dns_domain;
+               /*
+                * According to MS-NRPC 2.2.1.2.1 we should set the
+                * "DS_DNS_CONTROLLER" (M) and "DS_DNS_DOMAIN" (N) flags when
+                * the returned information is in DNS form.
+                */
+               response.data.nt5_ex.server_type |=
+                       DS_DNS_CONTROLLER | DS_DNS_DOMAIN;
        } else if (r->in.flags & DS_RETURN_FLAT_NAME) {
                dc_name = response.data.nt5_ex.pdc_name;
                domain_name = response.data.nt5_ex.domain_name;