summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}