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

initial attempt at a modrdn fix



Here are my patches that appear to work as far as fixing modrdn go.

I don't guarantee that they actually work, and reccomend someone that
understands the slapd engine better double-check all my code.  I probably
missed some access control stuff, and am not 100% sure I got all my memory
management correct.  I also found the cache and locking system interface to
be awkward and am not sure I got that right.

Also, i've had to move functions around between modules/source files, and am
not sure I did it in the appropriate manner.  ldbm_back_modrdn required
access to stuff that modify uses, so I moved stuff from modify.c to attr.c
and made it public instead of static.

This patch fixes the modrdn cache problems i observed -- when modrdn is
used, records go away until slapd is restarted (corrupt cache), and slapd
can die at any time in the future because of this corrupt cache.  To do
this, I dropped the cache_update_entry() call.  This seems to have done the
trick.  No matter what order I did the
cache_delete_entry()/cache_update_entry()/cache_return_entry_w( () (or
combinations thereof), it just wouldn't keep things in order.  This way, the
cache doesn't contain the old or updated entry, but does work when a client
asks for it.

Someone should also double-check my thread locking.

This patch also adds support to:
	- add the new rdn attribute/value
	- delete the old rdn attribute/value if asked to do so
	- update the lastmod attributes
	- update indexes for the above
	- test the modrdn changes in the test suite

diff -r -c -N -x Makefile ldap/servers/slapd/attr.c
openldap-1.2.0.orig/servers/slapd/attr.c
*** ldap/servers/slapd/attr.c	Tue Feb 23 17:42:03 1999
--- openldap-1.2.0.orig/servers/slapd/attr.c	Sun Nov 29 16:52:35 1998
***************
*** 343,418 ****
  }

  #endif
-
- void
- add_lastmods( Operation *op, LDAPMod **mods )
- {
- 	char		buf[22];
- 	struct berval	bv;
- 	struct berval	*bvals[2];
- 	LDAPMod		**m;
- 	LDAPMod		*tmp;
- 	struct tm	*ltm;
-
- 	Debug( LDAP_DEBUG_TRACE, "add_lastmods\n", 0, 0, 0 );
-
- 	bvals[0] = &bv;
- 	bvals[1] = NULL;
-
- 	/* remove any attempts by the user to modify these attrs */
- 	for ( m = mods; *m != NULL; m = &(*m)->mod_next ) {
-             if ( strcasecmp( (*m)->mod_type, "modifytimestamp" ) == 0 ||
- 				strcasecmp( (*m)->mod_type, "modifiersname" ) == 0 ||
- 				strcasecmp( (*m)->mod_type, "createtimestamp" ) == 0 ||
- 				strcasecmp( (*m)->mod_type, "creatorsname" ) == 0 ) {
-
-                 Debug( LDAP_DEBUG_TRACE,
- 					"add_lastmods: found lastmod attr: %s\n",
- 					(*m)->mod_type, 0, 0 );
-                 tmp = *m;
-                 *m = (*m)->mod_next;
-                 free( tmp->mod_type );
-                 if ( tmp->mod_bvalues != NULL ) {
-                     ber_bvecfree( tmp->mod_bvalues );
-                 }
-                 free( tmp );
-                 if (!*m)
-                     break;
-             }
-         }
-
- 	if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) {
- 		bv.bv_val = "NULLDN";
- 		bv.bv_len = strlen( bv.bv_val );
- 	} else {
- 		bv.bv_val = op->o_dn;
- 		bv.bv_len = strlen( bv.bv_val );
- 	}
- 	tmp = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
- 	tmp->mod_type = ch_strdup( "modifiersname" );
- 	tmp->mod_op = LDAP_MOD_REPLACE;
- 	tmp->mod_bvalues = (struct berval **) ch_calloc( 1,
- 	    2 * sizeof(struct berval *) );
- 	tmp->mod_bvalues[0] = ber_bvdup( &bv );
- 	tmp->mod_next = *mods;
- 	*mods = tmp;
-
- 	ldap_pvt_thread_mutex_lock( &currenttime_mutex );
- #ifndef LDAP_LOCALTIME
- 	ltm = gmtime( &currenttime );
- 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
- #else
- 	ltm = localtime( &currenttime );
- 	strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
- #endif
- 	ldap_pvt_thread_mutex_unlock( &currenttime_mutex );
- 	bv.bv_val = buf;
- 	bv.bv_len = strlen( bv.bv_val );
- 	tmp = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
- 	tmp->mod_type = ch_strdup( "modifytimestamp" );
- 	tmp->mod_op = LDAP_MOD_REPLACE;
- 	tmp->mod_bvalues = (struct berval **) ch_calloc( 1, 2 * sizeof(struct
berval *) );
- 	tmp->mod_bvalues[0] = ber_bvdup( &bv );
- 	tmp->mod_next = *mods;
- 	*mods = tmp;
- }
--- 343,345 ----
diff -r -c -N -x Makefile ldap/servers/slapd/back-ldbm/attr.c
openldap-1.2.0.orig/servers/slapd/back-ldbm/attr.c
*** ldap/servers/slapd/back-ldbm/attr.c	Tue Feb 23 15:57:37 1999
--- openldap-1.2.0.orig/servers/slapd/back-ldbm/attr.c	Sun Nov 29 16:52:35
1998
***************
*** 164,283 ****
  	if ( argc > 1 )
  		charray_free( indexes );
  }
-
-
- void
- ldbm_back_modlist_free(
-     LDAPMod	*mods
- )
- {
- 	LDAPMod	*next;
-
- 	for ( ; mods != NULL; mods = next ) {
- 		next = mods->mod_next;
- 		free( mods->mod_type );
- 		if ( mods->mod_bvalues != NULL )
- 			ber_bvecfree( mods->mod_bvalues );
- 		free( mods );
- 	}
- }
-
- int
- add_values(
-     Entry	*e,
-     LDAPMod	*mod,
-     char	*dn
- )
- {
- 	int		i;
- 	Attribute	*a;
-
- 	/* check if the values we're adding already exist */
- 	if ( (a = attr_find( e->e_attrs, mod->mod_type )) != NULL ) {
- 		for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
- 			if ( value_find( a->a_vals, mod->mod_bvalues[i],
- 			    a->a_syntax, 3 ) == 0 ) {
- 				return( LDAP_TYPE_OR_VALUE_EXISTS );
- 			}
- 		}
- 	}
-
- 	/* no - add them */
- 	if( attr_merge( e, mod->mod_type, mod->mod_bvalues ) != 0 ) {
- 		return( LDAP_CONSTRAINT_VIOLATION );
- 	}
-
- 	return( LDAP_SUCCESS );
- }
-
- int
- delete_values(
-     Entry	*e,
-     LDAPMod	*mod,
-     char	*dn
- )
- {
- 	int		i, j, k, found;
- 	Attribute	*a;
-
- 	/* delete the entire attribute */
- 	if ( mod->mod_bvalues == NULL ) {
- 		Debug( LDAP_DEBUG_ARGS, "removing entire attribute %s\n",
- 		    mod->mod_type, 0, 0 );
- 		return( attr_delete( &e->e_attrs, mod->mod_type ) ?
- 		    LDAP_NO_SUCH_ATTRIBUTE : LDAP_SUCCESS );
- 	}
-
- 	/* delete specific values - find the attribute first */
- 	if ( (a = attr_find( e->e_attrs, mod->mod_type )) == NULL ) {
- 		Debug( LDAP_DEBUG_ARGS, "could not find attribute %s\n",
- 		    mod->mod_type, 0, 0 );
- 		return( LDAP_NO_SUCH_ATTRIBUTE );
- 	}
-
- 	/* find each value to delete */
- 	for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
- 		found = 0;
- 		for ( j = 0; a->a_vals[j] != NULL; j++ ) {
- 			if ( value_cmp( mod->mod_bvalues[i], a->a_vals[j],
- 			    a->a_syntax, 3 ) != 0 ) {
- 				continue;
- 			}
- 			found = 1;
-
- 			/* found a matching value - delete it */
- 			ber_bvfree( a->a_vals[j] );
- 			for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
- 				a->a_vals[k - 1] = a->a_vals[k];
- 			}
- 			a->a_vals[k - 1] = NULL;
- 			break;
- 		}
-
- 		/* looked through them all w/o finding it */
- 		if ( ! found ) {
- 			Debug( LDAP_DEBUG_ARGS,
- 			    "could not find value for attr %s\n",
- 			    mod->mod_type, 0, 0 );
- 			return( LDAP_NO_SUCH_ATTRIBUTE );
- 		}
- 	}
-
- 	return( LDAP_SUCCESS );
- }
-
- int
- replace_values(
-     Entry	*e,
-     LDAPMod	*mod,
-     char	*dn
- )
- {
- 	(void) attr_delete( &e->e_attrs, mod->mod_type );
-
- 	if ( attr_merge( e, mod->mod_type, mod->mod_bvalues ) != 0 ) {
- 		return( LDAP_CONSTRAINT_VIOLATION );
- 	}
-
- 	return( LDAP_SUCCESS );
- }
--- 164,166 ----
diff -r -c -N -x Makefile ldap/servers/slapd/back-ldbm/modify.c
openldap-1.2.0.orig/servers/slapd/back-ldbm/modify.c
*** ldap/servers/slapd/back-ldbm/modify.c	Tue Feb 23 15:55:28 1999
--- openldap-1.2.0.orig/servers/slapd/back-ldbm/modify.c	Fri Jan 29 00:11:50
1999
***************
*** 11,16 ****
--- 11,20 ----
  #include "back-ldbm.h"
  #include "proto-back-ldbm.h"

+ static int	add_values(Entry *e, LDAPMod *mod, char *dn);
+ static int	delete_values(Entry *e, LDAPMod *mod, char *dn);
+ static int	replace_values(Entry *e, LDAPMod *mod, char *dn);
+
  int
  ldbm_back_modify(
      Backend	*be,
***************
*** 109,111 ****
--- 113,214 ----
  	return( -1 );
  }

+ static int
+ add_values(
+     Entry	*e,
+     LDAPMod	*mod,
+     char	*dn
+ )
+ {
+ 	int		i;
+ 	Attribute	*a;
+
+ 	/* check if the values we're adding already exist */
+ 	if ( (a = attr_find( e->e_attrs, mod->mod_type )) != NULL ) {
+ 		for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
+ 			if ( value_find( a->a_vals, mod->mod_bvalues[i],
+ 			    a->a_syntax, 3 ) == 0 ) {
+ 				return( LDAP_TYPE_OR_VALUE_EXISTS );
+ 			}
+ 		}
+ 	}
+
+ 	/* no - add them */
+ 	if( attr_merge( e, mod->mod_type, mod->mod_bvalues ) != 0 ) {
+ 		return( LDAP_CONSTRAINT_VIOLATION );
+ 	}
+
+ 	return( LDAP_SUCCESS );
+ }
+
+ static int
+ delete_values(
+     Entry	*e,
+     LDAPMod	*mod,
+     char	*dn
+ )
+ {
+ 	int		i, j, k, found;
+ 	Attribute	*a;
+
+ 	/* delete the entire attribute */
+ 	if ( mod->mod_bvalues == NULL ) {
+ 		Debug( LDAP_DEBUG_ARGS, "removing entire attribute %s\n",
+ 		    mod->mod_type, 0, 0 );
+ 		return( attr_delete( &e->e_attrs, mod->mod_type ) ?
+ 		    LDAP_NO_SUCH_ATTRIBUTE : LDAP_SUCCESS );
+ 	}
+
+ 	/* delete specific values - find the attribute first */
+ 	if ( (a = attr_find( e->e_attrs, mod->mod_type )) == NULL ) {
+ 		Debug( LDAP_DEBUG_ARGS, "could not find attribute %s\n",
+ 		    mod->mod_type, 0, 0 );
+ 		return( LDAP_NO_SUCH_ATTRIBUTE );
+ 	}
+
+ 	/* find each value to delete */
+ 	for ( i = 0; mod->mod_bvalues[i] != NULL; i++ ) {
+ 		found = 0;
+ 		for ( j = 0; a->a_vals[j] != NULL; j++ ) {
+ 			if ( value_cmp( mod->mod_bvalues[i], a->a_vals[j],
+ 			    a->a_syntax, 3 ) != 0 ) {
+ 				continue;
+ 			}
+ 			found = 1;
+
+ 			/* found a matching value - delete it */
+ 			ber_bvfree( a->a_vals[j] );
+ 			for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
+ 				a->a_vals[k - 1] = a->a_vals[k];
+ 			}
+ 			a->a_vals[k - 1] = NULL;
+ 			break;
+ 		}
+
+ 		/* looked through them all w/o finding it */
+ 		if ( ! found ) {
+ 			Debug( LDAP_DEBUG_ARGS,
+ 			    "could not find value for attr %s\n",
+ 			    mod->mod_type, 0, 0 );
+ 			return( LDAP_NO_SUCH_ATTRIBUTE );
+ 		}
+ 	}
+
+ 	return( LDAP_SUCCESS );
+ }
+
+ static int
+ replace_values(
+     Entry	*e,
+     LDAPMod	*mod,
+     char	*dn
+ )
+ {
+ 	(void) attr_delete( &e->e_attrs, mod->mod_type );
+
+ 	if ( attr_merge( e, mod->mod_type, mod->mod_bvalues ) != 0 ) {
+ 		return( LDAP_CONSTRAINT_VIOLATION );
+ 	}
+
+ 	return( LDAP_SUCCESS );
+ }
diff -r -c -N -x Makefile ldap/servers/slapd/back-ldbm/modrdn.c
openldap-1.2.0.orig/servers/slapd/back-ldbm/modrdn.c
*** ldap/servers/slapd/back-ldbm/modrdn.c	Tue Feb 23 17:43:21 1999
--- openldap-1.2.0.orig/servers/slapd/back-ldbm/modrdn.c	Thu Feb 11 15:29:34
1999
***************
*** 8,14 ****
  #include <ac/socket.h>

  #include "slap.h"
- #include "ldapconfig.h"
  #include "back-ldbm.h"
  #include "proto-back-ldbm.h"

--- 8,13 ----
***************
*** 26,38 ****
  	char		*matched = NULL;
  	char		*p_dn = NULL, *p_ndn = NULL;
  	char		*new_dn = NULL, *new_ndn = NULL;
- 	char		*new_dn_attr = NULL, *new_dn_nattr = NULL;
- 	char		*new_dn_value = NULL, *new_dn_nvalue = NULL;
- 	char		*old_dn_value = NULL, *old_dn_nvalue = NULL;
- 	LDAPMod		*mods = NULL, *modtail = NULL, *mod;
- 	char		*temps;
- 	int		err;
- 	struct berval	bv;
  	char		sep[2];
  	Entry		*e, *p = NULL;
  	int			rootlock = 0;
--- 25,30 ----
***************
*** 120,126 ****

  		new_dn = ch_strdup( newrdn );
  	}
!
  	new_ndn = dn_normalize_case( ch_strdup( new_dn ) );

  	if ( (dn2id ( be, new_ndn ) ) != NOID ) {
--- 112,118 ----

  		new_dn = ch_strdup( newrdn );
  	}
!
  	new_ndn = dn_normalize_case( ch_strdup( new_dn ) );

  	if ( (dn2id ( be, new_ndn ) ) != NOID ) {
***************
*** 136,144 ****
  	}
  	ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );

- 	/* changing the dn2id index should probably be delayed until after
- 	   we successfully update the id2entry index with a modified entry */
-
  	/* add new one */
  	if ( dn2id_add( be, new_ndn, e->e_id ) != 0 ) {
  		send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
--- 128,133 ----
***************
*** 156,320 ****
  	free( e->e_ndn );
  	e->e_dn = new_dn;
  	e->e_ndn = new_ndn;
!
!
! 	/* insert a new dnattr and update the indexes
! 	 * Delete the old dnattr if deleteoldrdn is true */
!
! 	/* Get the attribute name and new value */
! 	temps = ch_strdup(newrdn);
! 	new_dn_attr = strtok(temps,"=");
! 	if (new_dn_attr == NULL)
! 	{
! 		free(temps);
! 		Debug( LDAP_DEBUG_TRACE, "unable to locate attribute name\n",
! 			0, 0, 0);
! 		send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
! 			"unable to find attribute name");
! 		goto return_results;
! 	}
! 	new_dn_value = strtok(NULL,",");
! 	if (new_dn_value == NULL)
! 	{
! 		free(temps);
! 		Debug( LDAP_DEBUG_TRACE, "unable to locate attribute value\n",
! 			0, 0, 0);
! 		send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
! 			"unable to find attribute value");
! 		goto return_results;
! 	}
! 	new_dn_nvalue = ch_strdup(new_dn_value);
! 	new_dn_nattr = attr_normalize( ch_strdup(new_dn_attr) );
! 	free(temps);
!
! 	/* setup the mods structure */
! 	modtail = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
! 	mods = modtail;
!
! 	modtail->mod_op = LDAP_MOD_ADD;
! 	modtail->mod_type = new_dn_nattr;
! 	bv.bv_val = new_dn_nvalue;
! 	bv.bv_len = strlen(bv.bv_val);
! 	modtail->mod_bvalues = (struct berval **) ch_calloc( 1,
! 		2 * sizeof(struct berval *) );
! 	modtail->mod_bvalues[0] = ber_bvdup( &bv );
! 	modtail->mod_bvalues[1] = NULL;
!
! 	if (deleteoldrdn)
! 	{
! 		/* get the old attribute value */
! 		temps = dn_normalize_case ( ch_strdup(dn) );
! 		if (strtok(temps,"=") == NULL)
! 		{
! 			free(temps);
! 			Debug( LDAP_DEBUG_TRACE, "unable to locate attribute name\n",
! 				0, 0, 0);
! 			send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
! 				"unable to find attribute name");
! 			goto return_results;
! 		}
! 		old_dn_value = strtok(NULL,",");
! 		if (new_dn_value == NULL)
! 		{
! 			free(temps);
! 			Debug( LDAP_DEBUG_TRACE, "unable to locate attribute value\n",
! 				0, 0, 0);
! 			send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL,
! 				"unable to find attribute value");
! 			goto return_results;
! 		}
! 		old_dn_nvalue = ch_strdup(old_dn_value);
! 		free(temps);
!
! 		modtail->mod_next = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
! 		modtail = modtail->mod_next;
! 		modtail->mod_op = LDAP_MOD_DELETE;
! 		modtail->mod_type = new_dn_nattr;
! 		bv.bv_val = old_dn_nvalue;
! 		bv.bv_len = strlen(bv.bv_val);
! 		modtail->mod_bvalues = (struct berval **) ch_calloc( 1,
! 			2 * sizeof(struct berval *) );
! 		modtail->mod_bvalues[0] = ber_bvdup( &bv );
! 		modtail->mod_bvalues[1] = NULL;
! 	}
!
! 	modtail->mod_next = NULL;
!
! 	/* update last modified fields if necessary */
! 	if ( (be->be_lastmod == ON || ( be->be_lastmod == UNDEFINED &&
! 		global_lastmod == ON ) ) && be->be_update_ndn == NULL ) {
! 		add_lastmods( op, &mods );
! 	}
!
! 	if ( (err = acl_check_mods( be, conn, op, e, mods )) != LDAP_SUCCESS ) {
! 		send_ldap_result( conn, op, err, NULL, NULL );
! 		goto return_results;
! 	}
!
! 	for ( mod = mods; mod != NULL; mod = mod->mod_next ) {
! 		switch ( mod->mod_op & ~LDAP_MOD_BVALUES ) {
! 		case LDAP_MOD_ADD:
! 			err = add_values( e, mod, op->o_ndn );
! 			break;
!
! 		case LDAP_MOD_DELETE:
! 			err = delete_values( e, mod, op->o_ndn );
! 			break;
!
! 		case LDAP_MOD_REPLACE:
! 			err = replace_values( e, mod, op->o_ndn );
! 			break;
! 		}
!
! 		if ( err != LDAP_SUCCESS ) {
! 			/* unlock entry, delete from cache */
! 			send_ldap_result( conn, op, err, NULL, NULL );
! 			goto return_results;
! 		}
! 	}
!
! 	/* check that the entry still obeys the schema */
! 	if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
! 		Debug( LDAP_DEBUG_ANY, "entry failed schema check\n", 0, 0, 0 );
! 		send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, NULL, NULL );
! 		goto return_results;
! 	}
!
! 	/* check for abandon */
! 	ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
! 	if ( op->o_abandon ) {
! 		ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
! 		goto return_results;
! 	}
! 	ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
!
! 	/* modify indexes */
! 	if ( index_add_mods( be, mods, e->e_id ) != 0 ) {
! 		send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
! 		goto return_results;
! 	}

! 	/* check for abandon */
! 	ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
! 	if ( op->o_abandon ) {
! 		ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
! 		goto return_results;
! 	}
! 	ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );

  	/* id2entry index */
  	if ( id2entry_add( be, e ) != 0 ) {
  		send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
  		goto return_results;
  	}
!
  	send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
  	rc = 0;

  return_results:
! 	/* discard the modification list */
! 	ldbm_back_modlist_free(mods);
!
  	if( p != NULL ) {
  		/* free parent and writer lock */
  		cache_return_entry_w( &li->li_cache, p );
--- 145,179 ----
  	free( e->e_ndn );
  	e->e_dn = new_dn;
  	e->e_ndn = new_ndn;
! 	(void) cache_update_entry( &li->li_cache, e );

! 	/* XXX
! 	 * At some point here we need to update the attribute values in
! 	 * the entry itself that were effected by this RDN change
! 	 * (respecting the value of the deleteoldrdn parameter).
! 	 *
! 	 * Since the code to do this has not yet been written, treat this
! 	 * omission as a (documented) bug.
! 	 */

  	/* id2entry index */
  	if ( id2entry_add( be, e ) != 0 ) {
+ 		entry_free( e );
  		send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
  		goto return_results;
  	}
!
  	send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
  	rc = 0;

  return_results:
! 	if( new_dn != NULL ) free( new_dn );
! 	if( new_ndn != NULL ) free( new_ndn );
! 	if( p_dn != NULL ) free( p_dn );
! 	if( p_ndn != NULL ) free( p_ndn );
!
! 	if( matched != NULL ) free( matched );
!
  	if( p != NULL ) {
  		/* free parent and writer lock */
  		cache_return_entry_w( &li->li_cache, p );
***************
*** 327,349 ****

  	/* free entry and writer lock */
  	cache_return_entry_w( &li->li_cache, e );
-
- /*	Don't add the entry back into the cache.  Let the next request
- 	for this dn update the cache.  I can't quite make this work,
- 	and the old code was broken too */
- #ifdef NEVER_USE_BROKEN_CODE
- 	(void) cache_add_entry( &li->li_cache, e, 0 );
- #endif
-
- 	if( new_dn != NULL ) free( new_dn );
- 	if( new_ndn != NULL ) free( new_ndn );
- 	if( p_dn != NULL ) free( p_dn );
- 	if( p_ndn != NULL ) free( p_ndn );
- 	if ( new_dn_nattr != NULL) free ( new_dn_nattr );
- 	if ( new_dn_nvalue != NULL) free ( new_dn_nvalue );
- 	if ( old_dn_nvalue != NULL) free ( old_dn_nvalue );
-
- 	if( matched != NULL ) free( matched );
-
  	return( rc );
  }
--- 186,190 ----
diff -r -c -N -x Makefile ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
openldap-1.2.0.orig/servers/slapd/back-ldbm/proto-back-ldbm.h
*** ldap/servers/slapd/back-ldbm/proto-back-ldbm.h	Tue Feb 23 15:57:36 1999
--- openldap-1.2.0.orig/servers/slapd/back-ldbm/proto-back-ldbm.h	Wed Feb 10
14:36:53 1999
***************
*** 27,36 ****
   int *syntaxmask ));
  void attr_index_config LDAP_P(( struct ldbminfo *li, char *fname, int
lineno,
   int argc, char **argv, int init ));
- void 	ldbm_back_modlist_free LDAP_P(( LDAPMod	*mods ));
- int	add_values LDAP_P( (Entry *e, LDAPMod *mod, char *dn ));
- int	delete_values LDAP_P ((Entry *e, LDAPMod *mod, char *dn));
- int	replace_values LDAP_P ((Entry *e, LDAPMod *mod, char *dn));

  /*
   * cache.c
--- 27,32 ----
diff -r -c -N -x Makefile ldap/servers/slapd/modify.c
openldap-1.2.0.orig/servers/slapd/modify.c
*** ldap/servers/slapd/modify.c	Tue Feb 23 17:42:04 1999
--- openldap-1.2.0.orig/servers/slapd/modify.c	Fri Jan 29 00:11:49 1999
***************
*** 21,26 ****
--- 21,27 ----
  #include "slap.h"

  static void	modlist_free(LDAPMod *mods);
+ static void	add_lastmods(Operation *op, LDAPMod **mods);


  void
***************
*** 191,193 ****
--- 192,266 ----
  	}
  }

+ static void
+ add_lastmods( Operation *op, LDAPMod **mods )
+ {
+ 	char		buf[22];
+ 	struct berval	bv;
+ 	struct berval	*bvals[2];
+ 	LDAPMod		**m;
+ 	LDAPMod		*tmp;
+ 	struct tm	*ltm;
+
+ 	Debug( LDAP_DEBUG_TRACE, "add_lastmods\n", 0, 0, 0 );
+
+ 	bvals[0] = &bv;
+ 	bvals[1] = NULL;
+
+ 	/* remove any attempts by the user to modify these attrs */
+ 	for ( m = mods; *m != NULL; m = &(*m)->mod_next ) {
+             if ( strcasecmp( (*m)->mod_type, "modifytimestamp" ) == 0 ||
+ 				strcasecmp( (*m)->mod_type, "modifiersname" ) == 0 ||
+ 				strcasecmp( (*m)->mod_type, "createtimestamp" ) == 0 ||
+ 				strcasecmp( (*m)->mod_type, "creatorsname" ) == 0 ) {
+
+                 Debug( LDAP_DEBUG_TRACE,
+ 					"add_lastmods: found lastmod attr: %s\n",
+ 					(*m)->mod_type, 0, 0 );
+                 tmp = *m;
+                 *m = (*m)->mod_next;
+                 free( tmp->mod_type );
+                 if ( tmp->mod_bvalues != NULL ) {
+                     ber_bvecfree( tmp->mod_bvalues );
+                 }
+                 free( tmp );
+                 if (!*m)
+                     break;
+             }
+         }
+
+ 	if ( op->o_dn == NULL || op->o_dn[0] == '\0' ) {
+ 		bv.bv_val = "NULLDN";
+ 		bv.bv_len = strlen( bv.bv_val );
+ 	} else {
+ 		bv.bv_val = op->o_dn;
+ 		bv.bv_len = strlen( bv.bv_val );
+ 	}
+ 	tmp = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
+ 	tmp->mod_type = ch_strdup( "modifiersname" );
+ 	tmp->mod_op = LDAP_MOD_REPLACE;
+ 	tmp->mod_bvalues = (struct berval **) ch_calloc( 1,
+ 	    2 * sizeof(struct berval *) );
+ 	tmp->mod_bvalues[0] = ber_bvdup( &bv );
+ 	tmp->mod_next = *mods;
+ 	*mods = tmp;
+
+ 	ldap_pvt_thread_mutex_lock( &currenttime_mutex );
+ #ifndef LDAP_LOCALTIME
+ 	ltm = gmtime( &currenttime );
+ 	strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
+ #else
+ 	ltm = localtime( &currenttime );
+ 	strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
+ #endif
+ 	ldap_pvt_thread_mutex_unlock( &currenttime_mutex );
+ 	bv.bv_val = buf;
+ 	bv.bv_len = strlen( bv.bv_val );
+ 	tmp = (LDAPMod *) ch_calloc( 1, sizeof(LDAPMod) );
+ 	tmp->mod_type = ch_strdup( "modifytimestamp" );
+ 	tmp->mod_op = LDAP_MOD_REPLACE;
+ 	tmp->mod_bvalues = (struct berval **) ch_calloc( 1, 2 * sizeof(struct
berval *) );
+ 	tmp->mod_bvalues[0] = ber_bvdup( &bv );
+ 	tmp->mod_next = *mods;
+ 	*mods = tmp;
+ }
diff -r -c -N -x Makefile ldap/servers/slapd/proto-slap.h
openldap-1.2.0.orig/servers/slapd/proto-slap.h
*** ldap/servers/slapd/proto-slap.h	Tue Feb 23 17:42:04 1999
--- openldap-1.2.0.orig/servers/slapd/proto-slap.h	Sun Feb  7 13:42:24 1999
***************
*** 43,49 ****
  int attr_delete LDAP_P(( Attribute **attrs, char *type ));
  int attr_syntax LDAP_P(( char *type ));
  void attr_syntax_config LDAP_P(( char *fname, int lineno, int argc, char
**argv ));
- void	add_lastmods LDAP_P((Operation *op, LDAPMod **mods));

  /*
   * ava.c
--- 43,48 ----
diff -r -c -N -x Makefile ldap/tests/data/modrdn.out.master
openldap-1.2.0.orig/tests/data/modrdn.out.master
*** ldap/tests/data/modrdn.out.master	Tue Feb 23 18:15:37 1999
--- openldap-1.2.0.orig/tests/data/modrdn.out.master	Wed Dec 31 19:00:00
1969
***************
*** 1,402 ****
- dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
- member: cn=Manager, o=University of Michigan, c=US
- member: cn=Barbara Jensen, ou=Information Technology Division, ou=People,
o=Un
-  iversity of Michigan, c=US
- member: cn=Jane Doe, ou=Alumni Association, ou=People, o=University of
Michiga
-  n, c=US
- member: cn=John Doe, ou=Information Technology Division, ou=People,
o=Universi
-  ty of Michigan, c=US
- member: cn=Mark Elliot, ou=Alumni Association, ou=People, o=University of
Mich
-  igan, c=US
- member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- member: cn=James A Jones 2, ou=Information Technology Division, ou=People,
o=U
-  niversity of Michigan, c=US
- member: cn=Jennifer Smith, ou=Alumni Association, ou=People, o=University
of M
-  ichigan, c=US
- member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- member: cn=Ursula Hampster, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People,
o=Univ
-  ersity of Michigan, c=US
- associateddomain: umich.edu
- requeststo: cn=Manager, o=University of Michigan, c=US
- errorsto: cn=Manager, o=University of Michigan, c=US
- owner: cn=Manager, o=University of Michigan, c=US
- cn: All Staff
- joinable: FALSE
- multilinedescription: Everyone in the sample data
- objectclass: rfc822mailgroup
-
- dn: cn=Alumni Assoc Staff,ou=Groups,o=University of Michigan,c=US
- member: cn=Manager, o=University of Michigan, c=US
- member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- member: cn=Jane Doe, ou=Alumni Association, ou=People, o=University of
Michiga
-  n, c=US
- member: cn=Jennifer Smith, ou=Alumni Association, ou=People, o=University
of M
-  ichigan, c=US
- member: cn=Mark Elliot, ou=Alumni Association, ou=People, o=University of
Mich
-  igan, c=US
- member: cn=Ursula Hampster, ou=Alumni Association, ou=People, o=University
of
-  Michigan, c=US
- associateddomain: umich.edu
- requeststo: cn=Manager, o=University of Michigan, c=US
- errorsto: cn=Manager, o=University of Michigan, c=US
- owner: cn=Manager, o=University of Michigan, c=US
- multilinedescription: All Alumni Assoc Staff
- cn: Alumni Assoc Staff
- joinable: FALSE
- objectclass: rfc822mailgroup
-
- dn: ou=Alumni Association, ou=People, o=University of Michigan, c=US
- objectclass: top
- objectclass: organizationalUnit
- objectclass: quipuObject
- objectclass: quipuNonLeafObject
- ou: Alumni Association
-
- dn: cn=Barbara Jensen, ou=Information Technology Division, ou=People,
o=Univer
-  sity of Michigan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Barbara Jensen
- cn: Babs Jensen
- sn: Jensen
- title: Mythical Manager, Research Systems
- postaladdress: ITD Prod Dev & Deployment $ 535 W. William St. Room 4212 $
Ann
-  Arbor, MI 48103-4943
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: bjensen
- userpassword: bjensen
- mail: bjensen@mailgw.umich.edu
- homepostaladdress: 123 Wesley $ Ann Arbor, MI 48103
- krbname: bjensen@umich.edu
- multilinedescription: Mythical manager of the rsdd unix project
- nobatchupdates: TRUE
- notice: Off sailing this month.
- onvacation: FALSE
- labeledurl: http://www.umich.edu/ U-M Home Page
- drink: water
- lastmodifiedtime: 960404035839Z
- lastmodifiedby: cn=Barbara Jensen, ou=Information Technology Division,
ou=Peop
-  le, o=University of Michigan, c=US
- homephone: +1 313 555 2333
- pager: +1 313 555 3233
- facsimiletelephonenumber: +1 313 555 2274
- telephonenumber: +1 313 555 9022
-
- dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People,
o=Universi
-  ty of Michigan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Bjorn Jensen
- cn: Biiff Jensen
- sn: Jensen
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: bjorn
- userpassword: bjorn
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- homepostaladdress: 19923 Seven Mile Rd. $ South Lyon, MI 49999
- drink: Iced Tea
- multilinedescription: Hiker, biker
- title: Director, Embedded Systems
- postaladdress: Info Tech Division $ 535 W. William St. $ Ann Arbor, MI
48103
- mail: bjorn@mailgw.umich.edu
- homephone: +1 313 555 5444
- pager: +1 313 555 4474
- facsimiletelephonenumber: +1 313 555 2177
- telephonenumber: +1 313 555 0355
-
- dn: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of
Mich
-  igan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Dorothy Stevens
- cn: Dot Stevens
- sn: Stevens
- title: Secretary, UM Alumni Association
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: dots
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- drink: Lemonade
- homepostaladdress: 377 White St. Apt. 3 $ Ann Arbor, MI 48104
- multilinedescription: Very tall
- facsimiletelephonenumber: +1 313 555 3223
- telephonenumber: +1 313 555 3664
- mail: dots@mail.alumni.umich.edu
- homephone: +1 313 555 0454
-
- dn: ou=Groups, o=University of Michigan, c=US
- objectclass: top
- objectclass: organizationalUnit
- objectclass: quipuObject
- objectclass: quipuNonLeafObject
- ou: Groups
- lastmodifiedtime: 950120182331Z
- lastmodifiedby: cn=manager, o=university of michigan, c=US
-
- dn: ou=Information Technology Division, ou=People, o=University of
Michigan, c
-  =US
- objectclass: top
- objectclass: organizationalUnit
- objectclass: quipuObject
- objectclass: quipuNonLeafObject
- ou: Information Technology Divisio
-
- dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
- associateddomain: umich.edu
- requeststo: cn=Manager, o=University of Michigan, c=US
- errorsto: cn=Manager, o=University of Michigan, c=US
- owner: cn=Manager, o=University of Michigan, c=US
- multilinedescription: All ITD Staff
- cn: ITD Staff
- joinable: FALSE
- objectclass: rfc822mailgroup
- member: cn=Manager, o=University of Michigan, c=US
- member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People,
o=Univ
-  ersity of Michigan, c=US
- member: cn=James A Jones 2, ou=Information Technology Division, ou=People,
o=U
-  niversity of Michigan, c=US
- member: cn=John Doe, ou=Information Technology Division, ou=People,
o=Universi
-  ty of Michigan, c=US
- labeledurl: http://www.itd.umich.edu ITD Home Page
-
- dn: cn=Jaj-1 NEWRDN, ou=Alumni Association, ou=People, o=University of
Michiga
-  n, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: James A Jones 1
- cn: James Jones
- cn: Jim Jones
- cn: Jaj-1 NEWRDN
- sn: Jones
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: jaj
- krbname: jaj@umich.edu
- userpassword: jaj
- nobatchupdates: TRUE
- onvacation: FALSE
- homepostaladdress: 3882 Beverly Rd. $ Ann Arbor, MI 48105
- homephone: +1 313 555 4772
- multilinedescription: Outstanding
- title: Mad Cow Researcher, UM Alumni Association
- pager: +1 313 555 3923
- mail: jaj@mail.alumni.umich.edu
- facsimiletelephonenumber: +1 313 555 4332
- telephonenumber: +1 313 555 0895
-
- dn: cn=Jaj-2 NEWRDN, ou=Information Technology Division, ou=People,
o=Universi
-  ty of Michigan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: James Jones
- cn: Jim Jones
- cn: Jaj-2 NEWRDN
- sn: Doe
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: jjones
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- homepostaladdress: 933 Brooks $ Ann Arbor, MI 48104
- homephone: +1 313 555 8838
- title: Senior Manager, Information Technology Division
- multilinedescription: Not around very much
- mail: jjones@mailgw.umich.edu
- postaladdress: Info Tech Division $ 535 W William $ Ann Arbor, MI 48103
- pager: +1 313 555 2833
- facsimiletelephonenumber: +1 313 555 8688
- telephonenumber: +1 313 555 7334
-
- dn: cn=Jane Doe, ou=Alumni Association, ou=People, o=University of
Michigan, c
-  =US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Jane Doe
- cn: Jane Alverson
- sn: Doe
- title: Programmer Analyst, UM Alumni Association
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: jdoe
- homepostaladdress: 123 Anystreet $ Ann Arbor, MI 48104
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- drink: diet coke
- multilinedescription: Enthusiastic
- mail: jdoe@woof.net
- homephone: +1 313 555 5445
- pager: +1 313 555 1220
- facsimiletelephonenumber: +1 313 555 2311
- telephonenumber: +1 313 555 4774
-
- dn: cn=Jennifer Smith, ou=Alumni Association, ou=People, o=University of
Michi
-  gan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Jennifer Smith
- cn: Jen Smith
- sn: Smith
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: jen
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- drink: Sam Adams
- homepostaladdress: 1000 Maple #44 $ Ann Arbor, MI 48103
- title: Telemarketer, UM Alumni Association
- mail: jen@mail.alumni.umich.edu
- homephone: +1 313 555 2333
- pager: +1 313 555 6442
- facsimiletelephonenumber: +1 313 555 2756
- telephonenumber: +1 313 555 8232
-
- dn: cn=John Doe, ou=Information Technology Division, ou=People,
o=University o
-  f Michigan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: John Doe
- cn: Jonathon Doe
- sn: Doe
- postaladdress: ITD $ 535 W. William $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: johnd
- krbname: johnd@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- homepostaladdress: 912 East Bllvd $ Ann Arbor, MI 48104
- title: System Administrator, Information Technology Division
- multilinedescription: overworked!
- mail: johnd@mailgw.umich.edu
- homephone: +1 313 555 3774
- pager: +1 313 555 6573
- facsimiletelephonenumber: +1 313 555 4544
- telephonenumber: +1 313 555 9394
-
- dn: cn=Manager, o=University of Michigan, c=US
- objectclass: top
- objectclass: person
- objectclass: quipuObject
- objectclass: kerberosSecurityObject
- cn: Manager
- cn: Directory Manager
- cn: Dir Man
- sn: Manager
- description: Manager of the directory
- userpassword: secret
- lastmodifiedtime: 951212214144Z
- lastmodifiedby: cn=Manager, o=University of Michigan, c=US
- krbname: bjensen@umich.edu
-
- dn: cn=Mark Elliot, ou=Alumni Association, ou=People, o=University of
Michigan
-  , c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Mark Elliot
- cn: Mark A Elliot
- sn: Elliot
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: melliot
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- homepostaladdress: 199 Outer Drive $ Ypsilanti, MI 48198
- homephone: +1 313 555 0388
- drink: Gasoline
- title: Director, UM Alumni Association
- mail: melliot@mail.alumni.umich.edu
- pager: +1 313 555 7671
- facsimiletelephonenumber: +1 313 555 7762
- telephonenumber: +1 313 555 4177
-
- dn: ou=People, o=University of Michigan, c=US
- objectclass: top
- objectclass: organizationalUnit
- objectclass: quipuObject
- objectclass: quipuNonLeafObject
- ou: People
-
- dn: o=University of Michigan, c=US
- objectclass: top
- objectclass: organization
- objectclass: domainRelatedObject
- objectclass: quipuObject
- objectclass: quipuNonLeafObject
- l: Ann Arbor, Michigan
- st: Michigan
- streetaddress: 535 West William St.
- o: University of Michigan
- o: UMICH
- o: UM
- o: U-M
- o: U of M
- description: The University of Michigan at Ann Arbor
- postaladdress: University of Michigan $ 535 W. William St. $ Ann Arbor, MI
481
-  09 $ USpostalcode: 48109
- telephonenumber: +1 313 764-1817
- lastmodifiedtime: 930106182800Z
- lastmodifiedby: cn=manager, o=university of michigan, c=US
- associateddomain: umich.edu
-
- dn: cn=Ursula Hampster, ou=Alumni Association, ou=People, o=University of
Mich
-  igan, c=US
- objectclass: top
- objectclass: person
- objectclass: organizationalPerson
- objectclass: newPilotPerson
- objectclass: umichPerson
- cn: Ursula Hampster
- sn: Hampster
- title: Secretary, UM Alumni Association
- postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109
- seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
- uid: uham
- homepostaladdress: 123 Anystreet $ Ann Arbor, MI 48104
- krbname: jdoe@umich.edu
- nobatchupdates: TRUE
- onvacation: FALSE
- mail: uham@mail.alumni.umich.edu
- homephone: +1 313 555 8421
- pager: +1 313 555 2844
- facsimiletelephonenumber: +1 313 555 9700
- telephonenumber: +1 313 555 5331
--- 0 ----
diff -r -c -N -x Makefile ldap/tests/scripts/defines.sh
openldap-1.2.0.orig/tests/scripts/defines.sh
*** ldap/tests/scripts/defines.sh	Tue Feb 23 17:10:21 1999
--- openldap-1.2.0.orig/tests/scripts/defines.sh	Tue Jan 19 23:44:54 1999
***************
*** 6,12 ****
  LDAPSEARCH=../clients/tools/ldapsearch
  LDAPMODIFY=../clients/tools/ldapmodify
  LDAPADD=../clients/tools/ldapadd
- LDAPMODRDN=../clients/tools/ldapmodrdn
  LVL=5
  PORT=9009
  SLAVEPORT=9010
--- 6,11 ----
diff -r -c -N -x Makefile ldap/tests/scripts/test005-modrdn
openldap-1.2.0.orig/tests/scripts/test005-modrdn
*** ldap/tests/scripts/test005-modrdn	Tue Feb 23 18:15:07 1999
--- openldap-1.2.0.orig/tests/scripts/test005-modrdn	Wed Jan 13 20:02:14
1999
***************
*** 8,91 ****

  . $SRCDIR/scripts/defines.sh $SRCDIR

! echo "Cleaning up in $DBDIR..."
!
! rm -f $DBDIR/[!C]*
!
! echo "Running ldif2ldbm to build slapd database..."
! $LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools
! RC=$?
! if [ $RC != 0 ]; then
! 	echo "ldif2ldbm failed!"
! 	exit $RC
! fi
!
! echo "Starting slapd on TCP/IP port $PORT..."
! $SLAPD -f $CONF -p $PORT -d $LVL > $MASTERLOG 2>&1 &
! PID=$!
!
! echo "Testing slapd modrdn operations..."
! for i in 0 1 2 3 4 5; do
! 	$LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
! 		'cn=Manager' > /dev/null 2>&1
! 	RC=$?
! 	if [ $RC = 1 ]; then
! 		echo "Waiting 5 seconds for slapd to start..."
! 		sleep 5
! 	fi
! done
!
! if [ $RC != 0 ]; then
! 	echo "ldapsearch failed!"
! 	kill -HUP $PID
! 	exit $RC
! fi
!
! cat /dev/null > $TESTOUT
!
! echo "Testing modrdn (deleteoldrdn=0)..."
! $LDAPMODRDN -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD \
!   "cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of
Michigan, c=US" \
!   "cn=Jaj-1 NEWRDN" \
! 	> /dev/null 2>&1
! RC=$?
! if [ $RC != 0 ]; then
! 	echo "ldapmodrdn failed!"
! 	kill -HUP $PID
! 	exit $RC
! fi
!
! echo "Testing modrdn (deleteoldrdn=1)..."
! $LDAPMODRDN -r -v -D "$MANAGERDN" -h localhost -p $PORT -w $PASSWD \
!   "cn=James A Jones 2, ou=Information Technology Division, ou=People,
o=University of Michigan, c=US" \
!   "cn=Jaj-2 NEWRDN" \
! 	> /dev/null 2>&1
! RC=$?
! if [ $RC != 0 ]; then
! 	echo "ldapmodrdn failed!"
! 	kill -HUP $PID
! 	exit $RC
! fi
!
! echo "Using ldapsearch to retrieve all entries..."
! $LDAPSEARCH -L -S "" -b "$BASEDN" -h localhost -p $PORT \
! 	    'objectClass=*' | egrep -iv
'^createtimestamp:|^modifytimestamp:|^modifiersname:' \
! 	    > $SEARCHOUT 2>&1
! RC=$?
! kill -HUP $PID
! if [ $RC != 0 ]; then
! 	echo "ldapsearch failed!"
! 	exit $RC
! fi
!
! echo "Comparing database to reference file"
! cmp $SEARCHOUT $MODRDNOUTMASTER
! if [ $? != 0 ]; then
! 	echo "comparison failed - modify operations did not complete correctly"
! 	exit 1
! fi
!
! echo ">>>>> Test succeeded"
!
!
  exit 0
--- 8,12 ----

  . $SRCDIR/scripts/defines.sh $SRCDIR

! echo "modrdn test not yet written"
  exit 0



--
Roy Hooper
Sr. Systems Administrator
Cyberus Online Inc.
(613) 233-0068