Skip to content

Commit

Permalink
schema_set: Add comment about set schema from ldif in a transaction
Browse files Browse the repository at this point in the history
This is normally called with a transaction or before access is shared.
The python code and some tests may also cause an issue, but as these are
fixed at runtime, this is only a temporary issue that resolves itself.

Signed-off-by: Garming Sam <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
GSam authored and abartlet committed Nov 24, 2017
1 parent 17f1c6f commit 8eb95bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source4/dsdb/schema/schema_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,9 @@ WERROR dsdb_schema_set_el_from_ldb_msg(struct ldb_context *ldb,
* Rather than read a schema from the LDB itself, read it from an ldif
* file. This allows schema to be loaded and used while adding the
* schema itself to the directory.
*
* Should be called with a transaction (or failing that, have no concurrent
* access while called).
*/

WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb,
Expand Down Expand Up @@ -977,6 +980,13 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb,
}
}

/*
* TODO We may need a transaction here, otherwise this causes races.
*
* To do so may require an ldb_in_transaction function. In the
* meantime, assume that this is always called with a transaction or in
* isolation.
*/
ret = dsdb_set_schema(ldb, schema, SCHEMA_WRITE);
if (ret != LDB_SUCCESS) {
status = WERR_FOOBAR;
Expand Down

0 comments on commit 8eb95bc

Please sign in to comment.