[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba-cvs
Subject:    svn commit: samba r25762 - in branches/SAMBA_4_0:
From:       abartlet () samba ! org
Date:       2007-10-31 4:41:36
Message-ID: 20071031044136.EEA97162AE7 () lists ! samba ! org
[Download RAW message or body]

Author: abartlet
Date: 2007-10-31 04:41:36 +0000 (Wed, 31 Oct 2007)
New Revision: 25762

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

Log:
This test belongs best with the other checks for a valid parent, in
the objectclass module.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/subtree_rename.c
   branches/SAMBA_4_0/testprogs/ejs/ldap.js


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c	2007-10-31 \
                03:56:13 UTC (rev 25761)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/objectclass.c	2007-10-31 \
04:41:36 UTC (rev 25762) @@ -865,6 +865,14 @@
 	if (ldb_dn_is_special(req->op.rename.newdn)) { /* do not manipulate our control \
entries */  return ldb_next_request(module, req);
 	}
+	
+	/* Firstly ensure we are not trying to rename it to be a child of itself */
+	if ((ldb_dn_compare_base(req->op.rename.olddn, req->op.rename.newdn) == 0) 
+	    && (ldb_dn_compare(req->op.rename.olddn, req->op.rename.newdn) != 0)) {
+		ldb_asprintf_errstring(module->ldb, "Cannot rename %s to be a child of itself",
+				       ldb_dn_get_linearized(req->op.rename.olddn));
+		return LDB_ERR_UNWILLING_TO_PERFORM;
+	}
 
 	h = oc_init_handle(req, module);
 	if (!h) {

Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/subtree_rename.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/subtree_rename.c	2007-10-31 \
                03:56:13 UTC (rev 25761)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/subtree_rename.c	2007-10-31 \
04:41:36 UTC (rev 25762) @@ -163,14 +163,6 @@
 		return ldb_next_request(module, req);
 	}
 
-	/* Firstly ensure we are not trying to rename it to be a child of itself */
-	if ((ldb_dn_compare_base(req->op.rename.olddn, req->op.rename.newdn) == 0) 
-	    && (ldb_dn_compare(req->op.rename.olddn, req->op.rename.newdn) != 0)) {
-		ldb_asprintf_errstring(module->ldb, "Cannot rename %s to be a child of itself",
-				       ldb_dn_get_linearized(req->op.rename.olddn));
-		return LDB_ERR_UNWILLING_TO_PERFORM;
-	}
-
 	/* This gets complex:  We need to:
 	   - Do a search for all entires under this entry 
 	   - Wait for these results to appear

Modified: branches/SAMBA_4_0/testprogs/ejs/ldap.js
===================================================================
--- branches/SAMBA_4_0/testprogs/ejs/ldap.js	2007-10-31 03:56:13 UTC (rev 25761)
+++ branches/SAMBA_4_0/testprogs/ejs/ldap.js	2007-10-31 04:41:36 UTC (rev 25762)
@@ -295,6 +295,13 @@
 		assert(ok.error == 53);
 	}
 
+	println("Testing ldb.rename (into non-existent container) of \
cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer3," \
+ base_dn); +	ok = ldb.rename("cn=ldaptestcontainer2," + base_dn, \
"cn=ldaptestcontainer,cn=ldaptestcontainer3," + base_dn); +	if (ok.error != 53 && \
ok.error != 80) { /* LDAP_UNWILLING_TO_PERFORM or LDAP_OTHER*/ +		println(ok.errstr);
+		assert(ok.error == 53 || ok.error == 80);
+	}
+
 	println("Testing delete (should fail, not a leaf node) of renamed \
cn=ldaptestcontainer2," + base_dn);  ok = ldb.del("cn=ldaptestcontainer2," + \
base_dn);  if (ok.error != 66) { /* LDB_ERR_NOT_ALLOWED_ON_NON_LEAF */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic