From 58178c5019bece21e18449a776f67f990f34e74f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 11 Sep 2017 15:22:23 +1200 Subject: [PATCH] MASTER FIRST: schema: Rework dsdb_schema_set_indices_and_attributes() db operations Commit ec9b1e881c3eef503d6b4b311594113acf7d47d8 did not fully fix this. There is no value in using dsdb_replace(), we are under the read lock and replace just confuses things further. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13025 Signed-off-by: Andrew Bartlett (cherry picked from commit 96eb2b0abf8a68941cd38f2630857d5d1dec3468) --- source4/dsdb/schema/schema_set.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index cfd320b2407..8141e323e50 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -175,11 +175,11 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, } if (mod_msg->num_elements > 0) { /* - * Do the replace with the constructed message, - * to avoid needing a lock between this search - * and the replace + * Do the replace with the difference, as we + * are under the read lock and we wish to do a + * delete of any removed/renamed attributes */ - ret = dsdb_replace(ldb, msg, 0); + ret = dsdb_modify(ldb, mod_msg, 0); } talloc_free(mod_msg); } @@ -235,12 +235,13 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, * @SAMBA_FEATURES_SUPPORTED */ } else if (mod_msg->num_elements > 0) { + /* - * Do the replace with the constructed message, - * to avoid needing a lock between this search - * and the replace + * Do the replace with the difference, as we + * are under the read lock and we wish to do a + * delete of any removed/renamed attributes */ - ret = dsdb_replace(ldb, msg_idx, 0); + ret = dsdb_modify(ldb, mod_msg, 0); } talloc_free(mod_msg); } -- 2.11.0