Merge commit 'master/master'
[samba.git] / source4 / dsdb / samdb / ldb_modules / pdc_fsmo.c
index 270e79ecd8eb2a1f39ac4c54d28efb4a1ea76179..a5e7031a26f116817a6fe462205fba665f55ee73 100644 (file)
@@ -63,10 +63,9 @@ static int pdc_fsmo_init(struct ldb_module *module)
        }
        module->private_data = pdc_fsmo;
 
-       ret = ldb_search(module->ldb, pdc_dn,
-                        LDB_SCOPE_BASE,
-                        NULL, pdc_attrs,
-                        &pdc_res);
+       ret = ldb_search(module->ldb, mem_ctx, &pdc_res,
+                        pdc_dn, LDB_SCOPE_BASE,
+                        pdc_attrs, NULL);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "pdc_fsmo_init: no domain object present: (skip loading of domain details)\n");
@@ -79,7 +78,6 @@ static int pdc_fsmo_init(struct ldb_module *module)
                talloc_free(mem_ctx);
                return ret;
        }
-       talloc_steal(mem_ctx, pdc_res);
        if (pdc_res->count == 0) {
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "pdc_fsmo_init: no domain object present: (skip loading of domain details)\n");
@@ -115,7 +113,7 @@ static int pdc_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-const struct ldb_module_ops ldb_pdc_fsmo_module_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_pdc_fsmo_module_ops = {
        .name           = "pdc_fsmo",
        .init_context   = pdc_fsmo_init
 };