From efddd37af84b9db429237a491cb74a2c12c505cb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 6 Jun 2006 22:04:55 +0000 Subject: r16066: The OSX AD plugin uses objectCategory searches a lot, and uses them both fully qualified and in the 'short' form. Now we test and support this query format. Andrew Bartlett (This used to be commit 9ddcfacbcedc5eea2730d4bf902c0fcd02bcfa11) --- source4/lib/ldb/common/ldb_attributes.c | 1 - source4/lib/ldb/common/ldb_match.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c index 679a05f244..13e721a266 100644 --- a/source4/lib/ldb/common/ldb_attributes.c +++ b/source4/lib/ldb/common/ldb_attributes.c @@ -166,7 +166,6 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb) { "dn", LDB_SYNTAX_DN }, { "ncName", LDB_SYNTAX_DN }, { "distinguishedName", LDB_SYNTAX_DN }, - { "objectCategory", LDB_SYNTAX_DN }, { "cn", LDB_SYNTAX_DIRECTORY_STRING }, { "dc", LDB_SYNTAX_DIRECTORY_STRING }, { "ou", LDB_SYNTAX_DIRECTORY_STRING }, diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c index 810191c5ec..f3ecbe0381 100644 --- a/source4/lib/ldb/common/ldb_match.c +++ b/source4/lib/ldb/common/ldb_match.c @@ -207,8 +207,11 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, chunk = tree->u.substring.chunks[c]; if(h->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; - /* FIXME: case of embedded nulls */ - if (strncmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto failed; + /* This deals with wildcard prefix searches on binary attributes (eg objectGUID) */ + if (cnk.length > val.length) { + goto failed; + } + if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto failed; val.length -= cnk.length; val.data += cnk.length; c++; -- cgit