svn commit: samba r9318 - in branches/SAMBA_4_0/source/lib/ldb/common: .

metze at samba.org metze at samba.org
Tue Aug 16 06:55:42 GMT 2005


Author: metze
Date: 2005-08-16 06:55:40 +0000 (Tue, 16 Aug 2005)
New Revision: 9318

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9318

Log:
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
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2005-08-16 05:34:01 UTC (rev 9317)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_dn.c	2005-08-16 06:55:40 UTC (rev 9318)
@@ -415,6 +415,10 @@
 	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;

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c	2005-08-16 05:34:01 UTC (rev 9317)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_match.c	2005-08-16 06:55:40 UTC (rev 9318)
@@ -71,7 +71,7 @@
 		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;
 			}



More information about the samba-cvs mailing list