dsdb: Move ldb_set_default_dns() into rootdse_get_private_data()
authorAndrew Bartlett <abartlet@samba.org>
Mon, 9 Apr 2018 19:54:20 +0000 (07:54 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Apr 2018 03:15:17 +0000 (05:15 +0200)
This call needs to be done at the very first chance, in this case
during the first call to the lock_read() hook, otherwise the
schema_data module can't find the schema.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13379

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/rootdse.c

index 0d4cbc60f247a7d2a531df14a669db0ed28aca95..751fe15d1a17b8de3789131de5a55e622efb737c 100644 (file)
@@ -867,6 +867,8 @@ static struct rootdse_private_data *rootdse_get_private_data(struct ldb_module *
 {
        void *priv = ldb_module_get_private(module);
        struct rootdse_private_data *data = NULL;
+       struct ldb_context *ldb
+               = ldb_module_get_ctx(module);
 
        if (priv != NULL) {
                data = talloc_get_type_abort(priv,
@@ -889,6 +891,9 @@ static struct rootdse_private_data *rootdse_get_private_data(struct ldb_module *
        data->block_anonymous = true;
 
        ldb_module_set_private(module, data);
+
+       ldb_set_default_dns(ldb);
+
        return data;
 }
 
@@ -979,8 +984,6 @@ static int rootdse_init(struct ldb_module *module)
                return ldb_module_oom(module);
        }
 
-       ldb_set_default_dns(ldb);
-
        ret = ldb_next_init(module);
 
        if (ret != LDB_SUCCESS) {