s4-dsdb_schema: Seize using global_schema when referencing new schema for an LDB
authorKamen Mazdrashki <kamenim@samba.org>
Thu, 9 Dec 2010 02:31:14 +0000 (04:31 +0200)
committerKamen Mazdrashki <kamenim@samba.org>
Tue, 14 Dec 2010 23:51:18 +0000 (00:51 +0100)
Without this change, when a schema is set to ldb, the
effect is that dsdb_get_schema() returns global_schema
preferably.

Thus we end up with two schemas in effect:
- global one, which is the old one and it is still used everywhere
- new one, which is just cached in ldb, but can't be used, as
  there is no way to access it

source4/dsdb/schema/schema_set.c

index 21341157fe5ed265c4cfce47effbc9e453ab6776..004d7eb3a3b1dd4513adf89c92e8df1374c2044e 100644 (file)
@@ -452,6 +452,12 @@ int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema,
                return ldb_oom(ldb);
        }
 
+       /* Make this ldb use local schema preferably */
+       ret = ldb_set_opaque(ldb, "dsdb_use_global_schema", NULL);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
        ret = dsdb_schema_set_attributes(ldb, schema, write_attributes);
        if (ret != LDB_SUCCESS) {
                return ret;