r18908: Store the schema structure into an opaque pointer so that it can be reused...
authorSimo Sorce <idra@samba.org>
Mon, 25 Sep 2006 22:53:03 +0000 (22:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:20:19 +0000 (14:20 -0500)
(This used to be commit ca8827d8f9a9f6ec60afed29b0b85f491d725d1c)

source4/dsdb/samdb/ldb_modules/schema.c

index 95330e7e8cc11c60b688a3ce2ae7afa645b76a2a..1a7060a524f21e1b2fd55728a53c19284c47a275 100644 (file)
@@ -496,8 +496,8 @@ static int schema_init_classes(struct ldb_module *module, struct schema_private_
                data->class[i]->defobjcat = talloc_strdup(data->class[i],
                                                ldb_msg_find_attr_as_string(res->msgs[i],
                                                                        "defaultObjectCategory", NULL));
-               SCHEMA_CHECK_VALUE(data->class[i]->defobjcat, NULL, module);
-
+/*             SCHEMA_CHECK_VALUE(data->class[i]->defobjcat, NULL, module);
+*/
                /* the following attributes are all optional */
 
                data->class[i]->systemOnly = ldb_msg_find_attr_as_bool(res->msgs[i], "systemOnly", False);
@@ -1028,9 +1028,9 @@ static int schema_add_build_down_req(struct schema_context *sctx)
                if (!temp->next) break;
                if (temp->next->role != SCHEMA_CT_STRUCTURAL) break;
        }
-       oc = talloc_strdup(msg, temp->class->defobjcat);
+/*     oc = talloc_strdup(msg, temp->class->defobjcat);
        ret = ldb_msg_add_string(msg, "objectCategory", oc);
-
+*/
        sctx->down_req->op.add.message = msg;
 
        return LDB_SUCCESS;
@@ -1250,13 +1250,19 @@ static int schema_init(struct ldb_module *module)
        struct ldb_result *res;
        int ret;
 
-       /* need to let the partiorion module to register first */
+       /* need to let the partition module to register first */
        ret = ldb_next_init(module);
        if (ret != LDB_SUCCESS) {
                return ret;
        }
 
-       data = talloc_zero(module, struct schema_private_data);
+       data = ldb_get_opaque(module->ldb, "schema_instance");
+       if (data) {
+               module->private_data = data;
+               return LDB_SUCCESS;
+       }
+
+       data = talloc_zero(module->ldb, struct schema_private_data);
        if (data == NULL) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
@@ -1299,6 +1305,8 @@ static int schema_init(struct ldb_module *module)
        }
 
        module->private_data = data;
+       ldb_set_opaque(module->ldb, "schema_instance", data);
+
        return LDB_SUCCESS;
 }