From 27bcf7a0b6ab3a4c74129e3952c1bf14b8017b86 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Wed, 11 Apr 2012 21:09:38 +0200 Subject: [PATCH] LDB:ldb_tdb/ldb_tdb.c - allow LDB modify replaces with different value ordering This is essential for fixing up wrong ordered "objectClass" attributes. Signed-off-by: Andrew Tridgell --- lib/ldb/ldb_tdb/ldb_tdb.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index ebde8a34f92..5324c9b76fd 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -845,11 +845,18 @@ int ltdb_modify_internal(struct ldb_module *module, if (idx != -1) { j = (unsigned int) idx; el2 = &(msg2->elements[j]); - if (ldb_msg_element_compare(el, el2) == 0) { - /* we are replacing with the same values */ + + /* we consider two elements to be + * equal only if the order + * matches. This allows dbcheck to + * fix the ordering on attributes + * where order matters, such as + * objectClass + */ + if (ldb_msg_element_equal_ordered(el, el2)) { continue; } - + /* Delete the attribute if it exists in the DB */ if (msg_delete_attribute(module, ldb, msg2, el->name) != 0) { -- 2.34.1