LDB:ldb_tdb/ldb_tdb.c - allow LDB modify replaces with different value ordering save-diskspace-tags/ldb-1.1.6
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 11 Apr 2012 19:09:38 +0000 (21:09 +0200)
committerAndrew Tridgell <tridge@samba.org>
Wed, 18 Apr 2012 05:48:05 +0000 (07:48 +0200)
This is essential for fixing up wrong ordered "objectClass" attributes.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
lib/ldb/ldb_tdb/ldb_tdb.c

index ebde8a34f92dd2913c1090dce7627d6d8fd7be75..5324c9b76fdf1e297bdda9ce0c3ac01c4a26b2c6 100644 (file)
@@ -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) {