summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-08-16 06:55:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:23 -0500
commit8609e7993237e5ffe54830299212c128e082d9b9 (patch)
tree06dbe3d968833c32ca395329d6fd7b94c8e768ab /source4
parent56aadf82af5e3c5feeeb0dc5a5c14fc6967b4336 (diff)
downloadsamba-8609e7993237e5ffe54830299212c128e082d9b9.tar.gz
samba-8609e7993237e5ffe54830299212c128e082d9b9.tar.bz2
samba-8609e7993237e5ffe54830299212c128e082d9b9.zip
r9318: fix searches with scope ONE and SUB,
the problem was that ldb_dn_compare_base() just looked at if both dn's mtach some how, and the following happens: basedn: CN=bar,DC=foo,DC=com dn: DC=foo,DC=com and dn: DC=foo,DC=com was return as result of a sub and base search and also the ONE search with basedn: DC=foo,DC=com returned this dn: CN=bla,CN=bar,DC=foo,DC=com metze (This used to be commit 2a107472c373e425013050e28b944c830f653a87)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c4
-rw-r--r--source4/lib/ldb/common/ldb_match.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index edb5124d99..5dcb540fa1 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -415,6 +415,10 @@ int ldb_dn_compare_base(struct ldb_context *ldb,
int ret;
int n0, n1;
+ if (base->comp_num > dn->comp_num) {
+ return (dn->comp_num - base->comp_num);
+ }
+
/* if the number of components doesn't match they differ */
n0 = base->comp_num - 1;
n1 = dn->comp_num - 1;
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c
index 7ff84f70c3..b6f5f5a18d 100644
--- a/source4/lib/ldb/common/ldb_match.c
+++ b/source4/lib/ldb/common/ldb_match.c
@@ -71,7 +71,7 @@ static int ldb_match_scope(struct ldb_context *ldb,
break;
case LDB_SCOPE_ONELEVEL:
- if (dn->comp_num != base->comp_num) {
+ if (dn->comp_num == (base->comp_num + 1)) {
if (ldb_dn_compare_base(ldb, base, dn) == 0) {
ret = 1;
}