#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
static int pdc_fsmo_init(struct ldb_module *module)
{
pdc_dn = samdb_base_dn(module->ldb);
if (!pdc_dn) {
ldb_debug(module->ldb, LDB_DEBUG_WARNING,
- "pdc_fsmo_init: no domain dn present: (skip loading of domain details)");
+ "pdc_fsmo_init: no domain dn present: (skip loading of domain details)\n");
talloc_free(mem_ctx);
return ldb_next_init(module);
}
}
module->private_data = pdc_fsmo;
- ret = ldb_search(module->ldb, pdc_dn,
- LDB_SCOPE_BASE,
- NULL, pdc_attrs,
- &pdc_res);
- if (ret != LDB_SUCCESS) {
+ 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");
+ talloc_free(mem_ctx);
+ return ldb_next_init(module);
+ } else if (ret != LDB_SUCCESS) {
ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
"pdc_fsmo_init: failed to search the domain object: %d:%s",
ret, ldb_strerror(ret));
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)");
+ "pdc_fsmo_init: no domain object present: (skip loading of domain details)\n");
talloc_free(mem_ctx);
return ldb_next_init(module);
} else if (pdc_res->count > 1) {
talloc_steal(module, pdc_fsmo);
ldb_debug(module->ldb, LDB_DEBUG_TRACE,
- "pdc_fsmo_init: we are master: %s",
+ "pdc_fsmo_init: we are master: %s\n",
(pdc_fsmo->we_are_master?"yes":"no"));
talloc_free(mem_ctx);
return ldb_next_init(module);
}
-static const struct ldb_module_ops pdc_fsmo_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_pdc_fsmo_module_ops = {
.name = "pdc_fsmo",
.init_context = pdc_fsmo_init
};
-
-int pdc_fsmo_module_init(void)
-{
- return ldb_register_module(&pdc_fsmo_ops);
-}