summaryrefslogtreecommitdiff
path: root/lib/ldb/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ldb/common')
-rw-r--r--lib/ldb/common/ldb_msg.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c
index 28c414e6b2..1a2bebc983 100644
--- a/lib/ldb/common/ldb_msg.c
+++ b/lib/ldb/common/ldb_msg.c
@@ -1185,3 +1185,15 @@ int ldb_msg_check_string_attribute(const struct ldb_message *msg,
return 0;
}
+
+/*
+ compare a ldb_val to a string
+*/
+int ldb_val_string_cmp(const struct ldb_val *v, const char *str)
+{
+ size_t len = strlen(str);
+ if (len != v->length) {
+ return len - v->length;
+ }
+ return strncmp((const char *)v->data, str, len);
+}