summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-08-15 13:14:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:53 -0500
commit0eb3ee32049eb5b76308e8ef4dc6af3db544afbb (patch)
treeffda8637719a563b96d74d14e1296ae378b1c79f /source4/lib/ldb
parent449c9f1f1c03fdc026c56a900dd23b9506dbabf1 (diff)
downloadsamba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.tar.gz
samba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.tar.bz2
samba-0eb3ee32049eb5b76308e8ef4dc6af3db544afbb.zip
r24459: Fix up ldap.js and test_ldb.sh to test the domain_scope control, and
to test the behaviour of objectCategory=user searches. It turns out (thanks to a hint on http://blog.joeware.net/2005/12/08/147/) that objectCategory=user maps into objectCategory=CN=Person,... (by the defaultObjectCategory of that objectclass). Simplify the entryUUID module by using the fact that we now set the DN as the canoncical form of objectCategory. Andrew Bartlett (This used to be commit b474be9507df51982a604289215bb1868124fc24)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/samba/ldif_handlers.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/source4/lib/ldb/samba/ldif_handlers.c b/source4/lib/ldb/samba/ldif_handlers.c
index 3e9591cb86..eadf49518f 100644
--- a/source4/lib/ldb/samba/ldif_handlers.c
+++ b/source4/lib/ldb/samba/ldif_handlers.c
@@ -2,7 +2,7 @@
ldb database library - ldif handlers for Samba
Copyright (C) Andrew Tridgell 2005
- Copyright (C) Andrew Bartlett 2006
+ Copyright (C) Andrew Bartlett 2006-2007
** NOTE! The following LGPL license applies to the ldb
** library. This does NOT imply that all of Samba is released
** under the LGPL
@@ -309,24 +309,17 @@ static int ldif_canonicalise_objectCategory(struct ldb_context *ldb, void *mem_c
if ( ! ldb_dn_validate(dn1)) {
const char *lDAPDisplayName = talloc_strndup(mem_ctx, (char *)in->data, in->length);
class = dsdb_class_by_lDAPDisplayName(schema, lDAPDisplayName);
- talloc_free(lDAPDisplayName);
- } else if (ldb_dn_get_comp_num(dn1) >= 1 && ldb_attr_cmp(ldb_dn_get_rdn_name(dn1), "cn") == 0) {
- const struct ldb_val *val = ldb_dn_get_rdn_val(dn1);
- const char *cn = talloc_strndup(mem_ctx, (char *)val->data, val->length);
- class = dsdb_class_by_cn(schema, cn);
- talloc_free(cn);
- } else {
- talloc_free(dn1);
- return -1;
- }
- talloc_free(dn1);
-
- if (!class) {
- return -1;
+ if (class) {
+ struct ldb_dn *dn = ldb_dn_new(mem_ctx, ldb,
+ class->defaultObjectCategory);
+ *out = data_blob_string_const(ldb_dn_get_casefold(dn));
+ return LDB_SUCCESS;
+ } else {
+ *out = data_blob_talloc(mem_ctx, in->data, in->length);
+ return LDB_SUCCESS;
+ }
}
-
- *out = data_blob_string_const(talloc_strdup(mem_ctx, class->lDAPDisplayName));
-
+ *out = data_blob_string_const(ldb_dn_get_casefold(dn1));
return LDB_SUCCESS;
}
@@ -341,9 +334,9 @@ static int ldif_comparison_objectCategory(struct ldb_context *ldb, void *mem_ctx
ret2 = ldif_canonicalise_objectCategory(ldb, mem_ctx, v2, &v2_canon);
if (ret1 == LDB_SUCCESS && ret2 == LDB_SUCCESS) {
- return ldb_attr_cmp(v1_canon.data, v2_canon.data);
+ return data_blob_cmp(&v1_canon, &v2_canon);
} else {
- return strcasecmp(v1->data, v2->data);
+ return data_blob_cmp(v1, v2);
}
}