summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-01-09 17:42:05 +1100
committerAndrew Tridgell <tridge@samba.org>2010-01-09 18:56:29 +1100
commit8c2d7ae19e5a14ffa37af60ff4eec4d79f70040b (patch)
treea265bedbaeb77cfaab82208db98cc0ce5f45ccf8 /source4
parentacf33e0d58b38c9c621e2dc0837c07a99c95acc2 (diff)
downloadsamba-8c2d7ae19e5a14ffa37af60ff4eec4d79f70040b.tar.gz
samba-8c2d7ae19e5a14ffa37af60ff4eec4d79f70040b.tar.bz2
samba-8c2d7ae19e5a14ffa37af60ff4eec4d79f70040b.zip
s4-dsdb: added samdb_ldb_val_case_cmp()
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/common/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 632025da54..139ea4dc6b 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3198,3 +3198,19 @@ int dsdb_tombstone_lifetime(struct ldb_context *ldb, uint32_t *lifetime)
talloc_free(dn);
return LDB_SUCCESS;
}
+
+/*
+ compare a ldb_val to a string case insensitively
+ */
+int samdb_ldb_val_case_cmp(const char *s, struct ldb_val *v)
+{
+ size_t len = strlen(s);
+ int ret;
+ if (len > v->length) return 1;
+ ret = strncasecmp(s, (const char *)v->data, v->length);
+ if (ret != 0) return ret;
+ if (v->length > len && v->data[len] != 0) {
+ return -1;
+ }
+ return 0;
+}