From 9deb650fa2b93338ca91ccc96a940d670d29cbee Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 17 Apr 2012 14:01:08 +1000 Subject: ldb: added ldb_msg_element_equal_ordered() this gives us a order sensitive msg element comparison. We need this to allow dbcheck to fix the order of objectClass attributes. --- lib/ldb/common/ldb_msg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/ldb/common') diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c index c17e5f37cf..35c568a077 100644 --- a/lib/ldb/common/ldb_msg.c +++ b/lib/ldb/common/ldb_msg.c @@ -359,6 +359,26 @@ int ldb_msg_element_compare(struct ldb_message_element *el1, return 0; } +/* + compare two ldb_message_element structures. + Different ordering is considered a mismatch +*/ +bool ldb_msg_element_equal_ordered(const struct ldb_message_element *el1, + const struct ldb_message_element *el2) +{ + unsigned i; + if (el1->num_values != el2->num_values) { + return false; + } + for (i=0;inum_values;i++) { + if (ldb_val_equal_exact(&el1->values[i], + &el2->values[i]) != 1) { + return false; + } + } + return true; +} + /* compare two ldb_message_element structures comparing by element name -- cgit