1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s4-dsdb: added samdb_ldb_val_case_cmp()

This commit is contained in:
Andrew Tridgell 2010-01-09 17:42:05 +11:00
parent acf33e0d58
commit 8c2d7ae19e

View File

@ -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;
}