summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/samdb.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-12-28 04:52:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:30:19 -0500
commit6d85ab62752cbc9bb7426c8df67b7dc644871099 (patch)
tree22e0ec32d556db8e2d32e2d2d4499caba901798c /source4/dsdb/samdb/samdb.c
parent2bbf187698f6f2ec465173fd21078b4d27abc15b (diff)
downloadsamba-6d85ab62752cbc9bb7426c8df67b7dc644871099.tar.gz
samba-6d85ab62752cbc9bb7426c8df67b7dc644871099.tar.bz2
samba-6d85ab62752cbc9bb7426c8df67b7dc644871099.zip
r20377: Rework the CrackNames implementation to handle some of the BUILTIN sid
cases. Adjust our 'look for this value in this attribute, of the result' function samdb_find_attribute() to use the correct comparison function, no matter what that may be. Andrew Bartlett (This used to be commit 3c5ff4e68748cce0bb93d7d141083922d92c3845)
Diffstat (limited to 'source4/dsdb/samdb/samdb.c')
-rw-r--r--source4/dsdb/samdb/samdb.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 19c6ed773d..e5eafb9188 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -632,21 +632,32 @@ struct ldb_message_element *samdb_find_attribute(struct ldb_context *ldb,
{
int i;
struct ldb_message_element *el = ldb_msg_find_element(msg, name);
+ const struct ldb_schema_attribute *a;
struct ldb_val v;
+ TALLOC_CTX *tmp_ctx = talloc_new(ldb);
+ if (!tmp_ctx) {
+ return NULL;
+ }
+
v.data = discard_const_p(uint8_t, value);
v.length = strlen(value);
if (!el) {
+ talloc_free(tmp_ctx);
return NULL;
}
+ a = ldb_schema_attribute_by_name(ldb, name);
+
for (i=0;i<el->num_values;i++) {
- if (strcasecmp(value, (char *)el->values[i].data) == 0) {
+ if (a->syntax->comparison_fn(ldb, tmp_ctx, &el->values[i], &v) == 0) {
+ talloc_free(tmp_ctx);
return el;
}
}
+ talloc_free(tmp_ctx);
return NULL;
}