s4-cldap: Set DS_DNS_CONTROLLER bit if we are running RPC dnsserver
[kai/samba.git] / source4 / cldap_server / netlogon.c
index 0c4abebf8354a0da73d386325e0650e2b34ecf7d..e9ec0745f4164b7a9f1132958f066976602bedf6 100644 (file)
@@ -61,6 +61,7 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
        struct ldb_result *dom_res = NULL, *user_res = NULL;
        int ret;
        const char **services = lpcfg_server_services(lp_ctx);
+       const char **rpc_services = lpcfg_dcerpc_endpoint_servers(lp_ctx);
        uint32_t server_type;
        const char *pdc_name;
        struct GUID domain_uuid;
@@ -226,11 +227,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;
        }
@@ -251,16 +247,13 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
                server_type |= DS_SERVER_KDC;
        }
 
-       if (samdb_rodc(sam_ctx, &am_rodc) == LDB_SUCCESS && !am_rodc) {
-               server_type |= DS_SERVER_WRITABLE;
+       if (str_list_check(rpc_services, "dnsserver")) {
+               server_type |= DS_DNS_CONTROLLER;
        }
 
-#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;
+       if (samdb_rodc(sam_ctx, &am_rodc) == LDB_SUCCESS && !am_rodc) {
+               server_type |= DS_SERVER_WRITABLE;
        }
-#endif
 
        pdc_name         = talloc_asprintf(mem_ctx, "\\\\%s",
                                           lpcfg_netbios_name(lp_ctx));