HACK doesn't work source4/dsdb/samdb/ldb_modules/resolve_oids.c
[metze/samba/wip.git] / source4 / dsdb / samdb / ldb_modules / resolve_oids.c
index 968bcf2674b915cde45ec62efba27c8dbe619e44..5dcf3f97397088e4d85cf2c799ba6eb73655e7ff 100644 (file)
@@ -443,19 +443,19 @@ static int resolve_oids_callback(struct ldb_request *req, struct ldb_reply *ares
                int ret;
 
                schema = dsdb_get_schema(ldb, NULL);
-               DBG_DEBUG("PID[%d] ac[%p] modify_schema[%p]\n",
+               DBG_ERR("PID[%d] ac[%p] modify_schema[%p]\n",
                        getpid(), ac, schema);
                ret = dsdb_set_global_schema(ldb);
                if (ret != LDB_SUCCESS) {
                        ldb_debug_set(ldb, LDB_DEBUG_FATAL,
                                      "dsdb_set_global_schema() failed: %d:%s: %s",
                                      ret, ldb_strerror(ret), ldb_errstring(ldb));
-                       return ret;
+                       return ldb_module_done(ac->req, NULL, NULL, ret);
                }
                ac->modified_schema = false;
                schema = dsdb_get_schema(ldb, NULL);
 
-               DBG_DEBUG("PID[%d] ac[%p] schema[%p|%llu]\n",
+               DBG_ERR("PID[%d] ac[%p] schema[%p|%llu]\n",
                        getpid(), ac, schema, (unsigned long long)schema->metadata_usn);
        }
 
@@ -678,7 +678,7 @@ static int resolve_oids_add(struct ldb_module *module, struct ldb_request *req)
 
        active_schema = schema;
        if (modify_schema != NULL) {
-               DBG_DEBUG("PID[%d] ac[%p] schema[%p|%llu] modify_schema[%p]\n%s\n",
+               DBG_ERR("PID[%d] ac[%p] schema[%p|%llu] modify_schema[%p]\n%s\n",
                        getpid(), ac, schema, (unsigned long long)schema->metadata_usn, modify_schema,
                        ldb_dn_get_linearized(msg->dn));
                ret = dsdb_set_schema(ldb, modify_schema, SCHEMA_MEMORY_ONLY);
@@ -699,6 +699,10 @@ static int resolve_oids_add(struct ldb_module *module, struct ldb_request *req)
                ac->modified_schema = true;
        }
 
+       if (!talloc_reference(msg, active_schema)) {
+               return ldb_oom(ldb);
+       }
+
        ret = resolve_oids_message_replace(ldb, active_schema, msg);
        if (ret != LDB_SUCCESS) {
                return ret;