From 4fc5a5e6c6bccb2adaf8c1de5589bfc3b6efdc31 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 1 Aug 2017 10:26:34 +1200 Subject: [PATCH] dsdb: Do not force a re-index of sam.ldb on upgrade to 4.7 This means that no compatibleFeatures or incompatibleFeatures will be honoured until a re-index, but that can be triggered when these features are set. New databases will still get this support. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12855 Signed-off-by: Andrew Bartlett --- source4/dsdb/schema/schema_set.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index df27e19a944..12a3cab2743 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -214,7 +214,27 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, if (ret != LDB_SUCCESS) { goto op_error; } - if (mod_msg->num_elements > 0) { + + /* + * We don't want to re-index just because we didn't + * see this flag + * + * DO NOT backport this logic earlier than 4.7, it + * isn't needed and would be dangerous before 4.6, + * where we add logic to samba_dsdb to manage + * @SAMBA_FEATURES_SUPPORTED and need to know if the + * DB has been re-opened by an earlier version. + * + */ + + if (mod_msg->num_elements == 1 + && ldb_attr_cmp(mod_msg->elements[0].name, + SAMBA_FEATURES_SUPPORTED_FLAG) == 0) { + /* + * Ignore only adding + * @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 -- 2.11.0