Use struct-based rather than function-based initialization for ldb modules everywhere.
[jelmer/samba4-debian.git] / source / dsdb / samdb / ldb_modules / schema_fsmo.c
index ade576ac99613944fe3ffd22c69eb295ad7821af..9c877475273ed79b21ed83b8fb04335ec6e40bb2 100644 (file)
@@ -46,7 +46,7 @@ static int schema_fsmo_init(struct ldb_module *module)
        struct ldb_result *c_res;
        uint32_t i;
        int ret;
-       const char *schema_attrs[] = {
+       static const char *schema_attrs[] = {
                "prefixMap",
                "schemaInfo",
                "fSMORoleOwner",
@@ -59,6 +59,7 @@ static int schema_fsmo_init(struct ldb_module *module)
 
        schema_dn = samdb_schema_dn(module->ldb);
        if (!schema_dn) {
+               ldb_reset_err_string(module->ldb);
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "schema_fsmo_init: no schema dn present: (skip schema loading)\n");
                return ldb_next_init(module);
@@ -91,6 +92,7 @@ static int schema_fsmo_init(struct ldb_module *module)
                         NULL, schema_attrs,
                         &schema_res);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+               ldb_reset_err_string(module->ldb);
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "schema_fsmo_init: no schema head present: (skip schema loading)\n");
                talloc_free(mem_ctx);
@@ -253,12 +255,7 @@ static int schema_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops schema_fsmo_ops = {
+const struct ldb_module_ops ldb_schema_fsmo_module_ops = {
        .name           = "schema_fsmo",
        .init_context   = schema_fsmo_init
 };
-
-int schema_fsmo_module_init(void)
-{
-       return ldb_register_module(&schema_fsmo_ops);
-}