]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/modrdn.c
Code clean-up.
[openldap] / servers / slapd / back-ldbm / modrdn.c
index 1fde75f49143c4c6eb052fd34d5dab1a883cf85b..f6ec2248fd6bb9162245294d1588fc823f957c8e 100644 (file)
@@ -80,7 +80,7 @@ ldbm_back_modrdn(
                    + 3 );
                if ( dn_type( e->e_dn ) == DN_X500 ) {
                        strcpy( new_dn, newrdn );
-                       strcat( new_dn, ", " );
+                       strcat( new_dn, "," );
                        strcat( new_dn, p_dn );
                } else {
                        char *s;
@@ -107,13 +107,13 @@ ldbm_back_modrdn(
                        goto return_results;
                }
 
-               pthread_mutex_lock(&li->li_root_mutex);
+               ldap_pvt_thread_mutex_lock(&li->li_root_mutex);
                rootlock = 1;
 
                new_dn = ch_strdup( newrdn );
        }
 
-       new_ndn = dn_normalize( ch_strdup( new_dn ) );
+       new_ndn = dn_normalize_case( ch_strdup( new_dn ) );
 
        if ( (dn2id ( be, new_ndn ) ) != NOID ) {
                send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, NULL, NULL );
@@ -121,12 +121,12 @@ ldbm_back_modrdn(
        }
 
        /* check for abandon */
-       pthread_mutex_lock( &op->o_abandonmutex );
+       ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
        if ( op->o_abandon ) {
-               pthread_mutex_unlock( &op->o_abandonmutex );
+               ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
                goto return_results;
        }
-       pthread_mutex_unlock( &op->o_abandonmutex );
+       ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
 
        /* add new one */
        if ( dn2id_add( be, new_ndn, e->e_id ) != 0 ) {
@@ -145,8 +145,9 @@ ldbm_back_modrdn(
        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).
@@ -176,10 +177,11 @@ return_results:
        if( p != NULL ) {
                /* free parent and writer lock */
                cache_return_entry_w( &li->li_cache, p );
+       }
 
-       } else if ( rootlock ) {
+       if ( rootlock ) {
                /* release root writer lock */
-               pthread_mutex_unlock(&li->li_root_mutex);
+               ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
        }
 
        /* free entry and writer lock */