summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-08-13 14:33:57 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-08-17 09:50:56 +1000
commit51d2d3df6db016250c12bf8c97374402dc4cb277 (patch)
tree705e5eb0db399294609a1ebf5e989c1a8eb2a123 /source4/dsdb
parente1e99a7c7bb3a69d2c522ef272301b0ba73efd7f (diff)
downloadsamba-51d2d3df6db016250c12bf8c97374402dc4cb277.tar.gz
samba-51d2d3df6db016250c12bf8c97374402dc4cb277.tar.bz2
samba-51d2d3df6db016250c12bf8c97374402dc4cb277.zip
s4:schema Allow a schema load on an unconnected database
This helps ensure we don't load the schema too often in the provision (allowing a reference in of the schema before the modules load). Andrew Bartlett
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/schema/schema_set.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c
index 630c0ba184..6745bde127 100644
--- a/source4/dsdb/schema/schema_set.c
+++ b/source4/dsdb/schema/schema_set.c
@@ -139,7 +139,7 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
}
}
- if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
+ if (ret == LDB_ERR_OPERATIONS_ERROR || ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
ret = LDB_SUCCESS;
}
@@ -166,7 +166,7 @@ static int dsdb_schema_set_attributes(struct ldb_context *ldb, struct dsdb_schem
ret = samdb_replace(ldb, mem_ctx, mod_msg);
}
}
- if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
+ if (ret == LDB_ERR_OPERATIONS_ERROR || ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
ret = LDB_SUCCESS;
}
@@ -372,7 +372,8 @@ static struct dsdb_schema *global_schema;
/**
* Make this ldb use a specified schema, already fully calculated and belonging to another ldb
*/
-int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema)
+int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema,
+ bool write_attributes)
{
int ret;
ret = ldb_set_opaque(ldb, "dsdb_schema", schema);
@@ -381,7 +382,7 @@ int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema)
}
/* Set the new attributes based on the new schema */
- ret = dsdb_schema_set_attributes(ldb, schema, false);
+ ret = dsdb_schema_set_attributes(ldb, schema, write_attributes);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -403,7 +404,7 @@ int dsdb_set_global_schema(struct ldb_context *ldb)
return LDB_SUCCESS;
}
- return dsdb_reference_schema(ldb, global_schema);
+ return dsdb_reference_schema(ldb, global_schema, false /* Don't write attributes, it's expensive */);
}
/**