[Date Prev][Date Next] [Chronological] [Thread] [Top]

Patch to fix bug in modrdn


If you specify a newrdn that is the same as the existing rdn, with 
deleteoldrdn true, the ldbm backend will perform the operation without 
checking for a possible schema violation. The attribute for the RDN 
is set to the same value and then removed; the entry is then declared 
invalid and vanishes from the directory.

The following patch catches this case and prints an error message. Is it 

On another note, is anybody working to make modrdn (with ldbm) move the 
child nodes of the entry being moved? At the moment it doesn't seem to 
work - moving a node with children moves the node, but the children vanish.
I can't see any code in place to attempt this.

If nobody is working on this, I can have a look at it.

The attached patch is against the OpenLDAP 2.0.7 source. It applies to 


Grahame Bowland                               
University Communications Services, The University of Western Australia
Phone: +61 8 9380 1175
--- ../../../../openldap-2.0.7/servers/slapd/back-ldbm/modrdn.c	Wed Sep  6 03:55:53 2000
+++ modrdn.c	Fri Feb 23 00:36:56 2001
@@ -375,6 +375,15 @@
 					NULL, "could not parse value from old RDN", NULL, NULL );
 				goto return_results;		
+			if ((!strcasecmp(old_rdn_val, new_rdn_val))) {
+				       "ldbm_back_modrdn: new RDN is the same as previous and deletion requested - avoiding schema violation\n",
+				       0, 0, 0 );
+				send_ldap_result( conn, op, LDAP_OTHER,
+					NULL, "new RDN same as old RDN, aborting before schema violation", NULL, NULL);
+				goto return_results;
+			}
 			del_bvals[0] = &del_bv;		/* Array of bervals */
 			del_bvals[1] = NULL;