From: Douglas Bagnall Date: Tue, 30 Apr 2019 22:35:46 +0000 (+1200) Subject: s4/replmd: delete checks flag before laborious search X-Git-Tag: tdb-1.4.1~240 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8488651bdd6e36252bd2edde4683fd0c5c998fe2;p=thirdparty%2Fsamba.git s4/replmd: delete checks flag before laborious search Most (perhaps all) attributes that are in the "must not remove" list also have the PRESERVEONDELETE bit set, and checking bits is much cheaper than a linear search involving strcasecmp. If we check the bit first we save work. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 7440e9b50f1..1b080137a2e 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -4612,10 +4612,10 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request dsdb_flags |= DSDB_REPLMD_VANISH_LINKS; } else if (sa->linkID == 0) { - if (ldb_attr_in_list(preserved_attrs, el->name)) { + if (sa->searchFlags & SEARCH_FLAG_PRESERVEONDELETE) { continue; } - if (sa->searchFlags & SEARCH_FLAG_PRESERVEONDELETE) { + if (ldb_attr_in_list(preserved_attrs, el->name)) { continue; } } else {