summaryrefslogtreecommitdiff
path: root/lib/ldb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2012-04-17 14:01:08 +1000
committerAndrew Tridgell <tridge@samba.org>2012-04-18 07:48:05 +0200
commit9deb650fa2b93338ca91ccc96a940d670d29cbee (patch)
treeb71a5b514e489f5484390c02a1ea39a38222503f /lib/ldb/common
parent010f2b89e20e13f4687700fd731fedfafb7c62eb (diff)
downloadsamba-9deb650fa2b93338ca91ccc96a940d670d29cbee.tar.gz
samba-9deb650fa2b93338ca91ccc96a940d670d29cbee.tar.bz2
samba-9deb650fa2b93338ca91ccc96a940d670d29cbee.zip
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.
Diffstat (limited to 'lib/ldb/common')
-rw-r--r--lib/ldb/common/ldb_msg.c20
1 files changed, 20 insertions, 0 deletions
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
@@ -360,6 +360,26 @@ int ldb_msg_element_compare(struct ldb_message_element *el1,
}
/*
+ 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;i<el1->num_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
*/