]> git.sur5r.net Git - openldap/commitdiff
Add orr_modlist member to request structure, containing a list of
authorLuke Howard <lukeh@openldap.org>
Sun, 1 Jan 2006 09:23:24 +0000 (09:23 +0000)
committerLuke Howard <lukeh@openldap.org>
Sun, 1 Jan 2006 09:23:24 +0000 (09:23 +0000)
modifications to be applied by the backend atomically with a modify
RDN request.

Handle updating of RDN values in frontend.

Code that calls a backend's be_modrdn should call slap_modrdn2mods(op, rs)
before invoking the backend and cleanup with slap_mods_free( op->orr_modlist, 1 ).
See do_modrdn() for an example.

servers/slapd/back-bdb/modrdn.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldif/ldif.c
servers/slapd/back-sql/modrdn.c
servers/slapd/modrdn.c
servers/slapd/proto-slap.h
servers/slapd/slap.h
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_pblock.c
servers/slapd/syncrepl.c

index 6a25d2882d0d49ac1844bc5c8b812039fde36463..f49ec514203e3a19b9e9c3b5cb54ef10a0a91106 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,9 +46,6 @@ bdb_modrdn( Operation *op, SlapReply *rs )
        struct berval   *np_ndn = NULL;                 /* newSuperior ndn */
        struct berval   *new_parent_dn = NULL;  /* np_dn, p_dn, or NULL */
 
-       /* Used to interface with bdb_modify_internal() */
-       Modifications   *mod = NULL;            /* Used to delete old rdn */
-
        int             manageDSAit = get_manageDSAit( op );
 
        u_int32_t       locker = 0;
@@ -72,6 +69,9 @@ bdb_modrdn( Operation *op, SlapReply *rs )
                op->o_req_dn.bv_val,op->oq_modrdn.rs_newrdn.bv_val,
                op->oq_modrdn.rs_newSup ? op->oq_modrdn.rs_newSup->bv_val : "NULL" );
 
+       if ( !SLAP_SHADOW( op->o_bd ))
+               slap_mods_opattrs( op, &op->orr_modlist, 1 );
+
        if( 0 ) {
 retry: /* transaction retry */
                if ( dummy.e_attrs ) {
@@ -563,13 +563,7 @@ retry:     /* transaction retry */
                }
        }
 
-       /* prepare modlist of modifications from old/new rdn */
-       if (!mod) {
-               rs->sr_err = slap_modrdn2mods( op, rs, e, old_rdn, new_rdn, &mod );
-               if ( rs->sr_err != LDAP_SUCCESS ) {
-                       goto return_results;
-               }
-       }
+       assert( op->orr_modlist != NULL );
 
        if( op->o_preread ) {
                if( preread_ctrl == NULL ) {
@@ -642,7 +636,7 @@ retry:      /* transaction retry */
        dummy.e_attrs = e->e_attrs;
 
        /* modify entry */
-       rs->sr_err = bdb_modify_internal( op, lt2, &mod[0], &dummy,
+       rs->sr_err = bdb_modify_internal( op, lt2, op->orr_modlist, &dummy,
                &rs->sr_text, textbuf, textlen );
        if( rs->sr_err != LDAP_SUCCESS ) {
                Debug(LDAP_DEBUG_TRACE,
@@ -801,10 +795,6 @@ done:
                ldap_rdnfree_x( old_rdn, op->o_tmpmemctx );
        }
 
-       if( mod != NULL ) {
-               slap_modrdn2mods_free( mod );
-       }
-
        /* LDAP v3 Support */
        if( np != NULL ) {
                /* free new parent and reader lock */
index 5a58bd78a0cefcb8d4b9e1b4fc8fe06adbe03ae6..d917786ab4fd58454074ac8d5363c64e16bb1e39 100644 (file)
@@ -58,7 +58,6 @@ ldbm_back_modrdn(
        struct berval   *np_ndn = NULL; /* newSuperior ndn */
        struct berval   *new_parent_dn = NULL;  /* np_dn, p_dn, or NULL */
        /* Used to interface with ldbm_modify_internal() */
-       Modifications   *mod = NULL;            /* Used to delete old/add new rdn */
        int             manageDSAit = get_manageDSAit( op );
 
        Debug( LDAP_DEBUG_TRACE,
@@ -67,6 +66,9 @@ ldbm_back_modrdn(
                ( op->oq_modrdn.rs_newSup && op->oq_modrdn.rs_newSup->bv_len )
                        ? op->oq_modrdn.rs_newSup->bv_val : "NULL", 0 );
 
+       if ( !SLAP_SHADOW( op->o_bd ))
+               slap_mods_opattrs( op, &op->orr_modlist, 1 );
+
        /* grab giant lock for writing */
        ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
 
@@ -371,10 +373,7 @@ ldbm_back_modrdn(
        Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: DN_X500\n",
               0, 0, 0 );
        
-       if ( slap_modrdn2mods( op, rs, e, old_rdn, new_rdn, &mod ) != LDAP_SUCCESS ) {
-               send_ldap_result( op, rs );
-               goto return_results;
-       }
+       assert( op->orr_modlist != NULL );
 
        /* check for abandon */
        if ( op->o_abandon ) {
@@ -396,7 +395,7 @@ ldbm_back_modrdn(
         */
 
        /* modify memory copy of entry */
-       rs->sr_err = ldbm_modify_internal( op, &mod[0], e,
+       rs->sr_err = ldbm_modify_internal( op, op->orr_modlist, e,
                &rs->sr_text, textbuf, textlen );
        switch ( rs->sr_err ) {
        case LDAP_SUCCESS:
@@ -471,9 +470,6 @@ return_results:
        if ( old_rdn != NULL ) {
                ldap_rdnfree( old_rdn );
        }
-       if ( mod != NULL ) {
-               slap_modrdn2mods_free( mod );
-       }
 
        /* LDAP v3 Support */
        if( np != NULL ) {
index cb2854f60049ff730dea8137c2ace01ffef58451..cbb30ba4634729ef624d331abb0316b68e8b4d1f 100644 (file)
@@ -973,9 +973,6 @@ ldif_back_modrdn(Operation *op, SlapReply *rs)
        struct berval new_dn = BER_BVNULL, new_ndn = BER_BVNULL;
        struct berval p_dn;
        Entry * entry = NULL;
-       LDAPRDN new_rdn = NULL;
-       LDAPRDN old_rdn = NULL;
-       Modifications * mods = NULL;
        int res;
 
        ldap_pvt_thread_mutex_lock( &ni->li_mutex );
@@ -984,59 +981,30 @@ ldif_back_modrdn(Operation *op, SlapReply *rs)
 
        /* build the mods to the entry */
        if ( entry != NULL ) {
-               if ( ldap_bv2rdn( &op->oq_modrdn.rs_newrdn, &new_rdn,
-                       (char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP ) )
-               {
-                       rs->sr_err = LDAP_INVALID_DN_SYNTAX;
-               } else if ( op->oq_modrdn.rs_deleteoldrdn &&
-                       ldap_bv2rdn(&op->o_req_dn, &old_rdn, (char **)&rs->sr_text,
-                       LDAP_DN_FORMAT_LDAP ) )
-               {
-                       rs->sr_err = LDAP_OTHER;
+               /* build new dn, and new ndn for the entry */
+               if ( op->oq_modrdn.rs_newSup != NULL ) {
+                       /* new superior */
+                       p_dn = *op->oq_modrdn.rs_newSup;
                } else {
-                       /* got both rdns successfully, ready to build mods */
-                       if ( slap_modrdn2mods( op, rs, entry, old_rdn, new_rdn, &mods )
-                               != LDAP_SUCCESS )
-                       {
-                               rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
-                       } else {
-                               /* built mods successfully */
-
-                               /* build new dn, and new ndn for the entry */
-                               if ( op->oq_modrdn.rs_newSup != NULL ) {
-                                       /* new superior */
-                                       p_dn = *op->oq_modrdn.rs_newSup;
-                               } else {
-                                       p_dn = slap_empty_bv;
-                               }
-                               dnParent( &entry->e_name, &p_dn );
-                               build_new_dn( &new_dn, &p_dn, &op->oq_modrdn.rs_newrdn, NULL ); 
-                               dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn, NULL );
-                               ber_memfree_x( entry->e_name.bv_val, NULL );
-                               ber_memfree_x( entry->e_nname.bv_val, NULL );
-                               entry->e_name = new_dn;
-                               entry->e_nname = new_ndn;
-
-                               /* perform the modifications */
-                               res = apply_modify_to_entry( entry, mods, op, rs );
-                               slap_modrdn2mods_free( mods );
-                               if ( res == LDAP_SUCCESS ) {
-                                       rs->sr_err = move_entry( entry, &op->o_req_ndn,
-                                                               &new_ndn,
-                                                               &op->o_bd->be_nsuffix[0],
-                                                               &ni->li_base_path );
-                               } else {
-                                       rs->sr_err = res;
-                               }
-                       }
+                       p_dn = slap_empty_bv;
                }
-
-               if ( new_rdn != NULL ) {
-                       ldap_rdnfree( new_rdn );
-               }
-
-               if ( old_rdn != NULL ) {
-                       ldap_rdnfree( old_rdn );
+               dnParent( &entry->e_name, &p_dn );
+               build_new_dn( &new_dn, &p_dn, &op->oq_modrdn.rs_newrdn, NULL ); 
+               dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn, NULL );
+               ber_memfree_x( entry->e_name.bv_val, NULL );
+               ber_memfree_x( entry->e_nname.bv_val, NULL );
+               entry->e_name = new_dn;
+               entry->e_nname = new_ndn;
+
+               /* perform the modifications */
+               res = apply_modify_to_entry( entry, op->orr_modlist, op, rs );
+               if ( res == LDAP_SUCCESS ) {
+                       rs->sr_err = move_entry( entry, &op->o_req_ndn,
+                                               &new_ndn,
+                                               &op->o_bd->be_nsuffix[0],
+                                               &ni->li_base_path );
+               } else {
+                       rs->sr_err = res;
                }
        } else {
                /* entry was null */
index 6b22c5de490bad708f3fb552955f8e88278808a0..198a9b2e8a1f62b216b6dd00fb2266c0c46a9560 100644 (file)
@@ -51,7 +51,6 @@ backsql_modrdn( Operation *op, SlapReply *rs )
                                n = { 0 },
                                *e = NULL;
        int                     manageDSAit = get_manageDSAit( op );
-       Modifications           *mod = NULL;
        struct berval           *newSuperior = op->oq_modrdn.rs_newSup;
        char                    *next;
  
@@ -430,14 +429,10 @@ backsql_modrdn( Operation *op, SlapReply *rs )
                }
        }
 
-       rs->sr_err = slap_modrdn2mods( op, rs, &r, old_rdn, new_rdn, &mod );
-       if ( rs->sr_err != LDAP_SUCCESS ) {
-               e = &r;
-               goto done;
-       }
+       assert( op->orr_modlist != NULL );
 
        oc = backsql_id2oc( bi, e_id.eid_oc_id );
-       rs->sr_err = backsql_modify_internal( op, rs, dbh, oc, &e_id, mod );
+       rs->sr_err = backsql_modify_internal( op, rs, dbh, oc, &e_id, op->orr_modlist );
        slap_graduate_commit_csn( op );
        if ( rs->sr_err != LDAP_SUCCESS ) {
                e = &r;
@@ -556,10 +551,6 @@ done:;
                ldap_rdnfree( old_rdn );
        }
 
-       if ( mod != NULL ) {
-               slap_modrdn2mods_free( mod );
-       }
-
        if ( !BER_BVISNULL( &e_id.eid_ndn ) ) {
                (void)backsql_free_entryID( op, &e_id, 0 );
        }
index 39165a37b03c9d4fe3f1c24150918cecd750e3b8..98902ae156fd540617e07e0bf961620f9e41e171 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -174,6 +174,13 @@ do_modrdn(
        /* FIXME: temporary? */
        op->orr_deleteoldrdn = deloldrdn;
 
+       /* prepare modlist of modifications from old/new RDN */
+       rs->sr_err = slap_modrdn2mods( op, rs );
+       if ( rs->sr_err != LDAP_SUCCESS ) {
+               send_ldap_result( op, rs );
+               goto cleanup;
+       }
+
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_modrdn( op, rs );
 
@@ -184,6 +191,9 @@ cleanup:
        op->o_tmpfree( op->orr_newrdn.bv_val, op->o_tmpmemctx );        
        op->o_tmpfree( op->orr_nnewrdn.bv_val, op->o_tmpmemctx );       
 
+       if ( op->orr_modlist != NULL )
+               slap_mods_free( op->orr_modlist, 1 );
+
        if ( !BER_BVISNULL( &pnewSuperior ) ) 
                op->o_tmpfree( pnewSuperior.bv_val, op->o_tmpmemctx );
        if ( !BER_BVISNULL( &nnewSuperior ) )
@@ -198,7 +208,7 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
        Backend         *newSuperior_be = NULL;
        int             manageDSAit;
        struct berval   pdn = BER_BVNULL;
-       BackendDB *op_be;
+       BackendDB       *op_be;
        
        if( op->o_req_ndn.bv_len == 0 ) {
                Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
@@ -377,20 +387,36 @@ cleanup:;
 int
 slap_modrdn2mods(
        Operation       *op,
-       SlapReply       *rs,
-       Entry           *e,
-       LDAPRDN         old_rdn,
-       LDAPRDN         new_rdn,
-       Modifications   **pmod )
+       SlapReply       *rs )
 {
-       Modifications   *mod = NULL;
        int             a_cnt, d_cnt;
-       int repl_user;
-
-       assert( new_rdn != NULL );
-       assert( !op->orr_deleteoldrdn || old_rdn != NULL );
+       LDAPRDN         old_rdn = NULL;
+       LDAPRDN         new_rdn = NULL;
+
+       assert( !BER_BVISEMPTY( &op->oq_modrdn.rs_newrdn ) );
+       assert( !op->orr_deleteoldrdn || !BER_BVISEMPTY( &op->o_req_dn ) );
+
+       if ( ldap_bv2rdn_x( &op->oq_modrdn.rs_newrdn, &new_rdn,
+               (char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) {
+               Debug( LDAP_DEBUG_TRACE,
+                       LDAP_XSTRING(slap_modrdn2mods) ": can't figure out "
+                       "type(s)/value(s) of newrdn\n", 0, 0, 0 );
+               rs->sr_err = LDAP_INVALID_DN_SYNTAX;
+               rs->sr_text = "unknown type(s) used in RDN";
+               goto done;
+       }
 
-       repl_user = be_isupdate( op );
+       if ( op->oq_modrdn.rs_deleteoldrdn ) {
+               if ( ldap_bv2rdn_x( &op->o_req_dn, &old_rdn,
+                       (char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) {
+                       Debug( LDAP_DEBUG_TRACE,
+                               LDAP_XSTRING(slap_modrdn2mods) ": can't figure out "
+                               "type(s)/value(s) of oldrdn\n", 0, 0, 0 );
+                       rs->sr_err = LDAP_OTHER;
+                       rs->sr_text = "cannot parse RDN from old DN";
+                       goto done;
+               }
+       }
 
        /* Add new attribute values to the entry */
        for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) {
@@ -401,33 +427,20 @@ slap_modrdn2mods(
 
                if ( rs->sr_err != LDAP_SUCCESS ) {
                        Debug( LDAP_DEBUG_TRACE,
-                               "slap_modrdn2modlist: %s: %s (new)\n",
+                               "slap_modrdn2mods: %s: %s (new)\n",
                                rs->sr_text, 
                                new_rdn[ a_cnt ]->la_attr.bv_val, 0 );
                        goto done;              
                }
 
-               /* ACL check of newly added attrs */
-               if ( op->o_bd && !access_allowed( op, e, desc,
-                       &new_rdn[a_cnt]->la_value, ACL_WADD, NULL ) ) {
-                       Debug( LDAP_DEBUG_TRACE,
-                               "slap_modrdn2modlist: access to attr \"%s\" "
-                               "(new) not allowed\n", 
-                               new_rdn[ a_cnt ]->la_attr.bv_val, 0, 0 );
-                       rs->sr_text = "access to naming attributes (new) not allowed";
-                       rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
-                       goto done;
-               }
-
                /* Apply modification */
-               mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
-                       + 4 * sizeof( struct berval ) );
+               mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) );
                mod_tmp->sml_desc = desc;
-               mod_tmp->sml_values = ( BerVarray )( mod_tmp + 1 );
-               mod_tmp->sml_values[0] = new_rdn[a_cnt]->la_value;
+               mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
+               ber_dupbv( &mod_tmp->sml_values[0], &new_rdn[a_cnt]->la_value );
                mod_tmp->sml_values[1].bv_val = NULL;
                if( desc->ad_type->sat_equality->smr_normalize) {
-                       mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
+                       mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
                        (void) (*desc->ad_type->sat_equality->smr_normalize)(
                                SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
                                desc->ad_type->sat_syntax,
@@ -440,8 +453,8 @@ slap_modrdn2mods(
                }
                mod_tmp->sml_op = SLAP_MOD_SOFTADD;
                mod_tmp->sml_flags = SLAP_MOD_INTERNAL;
-               mod_tmp->sml_next = mod;
-               mod = mod_tmp;
+               mod_tmp->sml_next = op->orr_modlist;
+               op->orr_modlist = mod_tmp;
        }
 
        /* Remove old rdn value if required */
@@ -453,96 +466,64 @@ slap_modrdn2mods(
                        rs->sr_err = slap_bv2ad( &old_rdn[d_cnt]->la_attr, &desc, &rs->sr_text );
                        if ( rs->sr_err != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_TRACE,
-                                       "slap_modrdn2modlist: %s: %s (old)\n",
+                                       "slap_modrdn2mods: %s: %s (old)\n",
                                        rs->sr_text, 
                                        old_rdn[d_cnt]->la_attr.bv_val, 
                                        0 );
                                goto done;              
                        }
 
-                       /* ACL check of old rdn attrs removal */
-                       if ( op->o_bd && !access_allowed( op, e, desc,
-                               &old_rdn[d_cnt]->la_value, ACL_WDEL, 
-                               NULL ) ) {
-                               Debug( LDAP_DEBUG_TRACE,
-                                       "slap_modrdn2modlist: access "
-                                       "to attr \"%s\" (old) not allowed\n", 
-                                       old_rdn[ d_cnt ]->la_attr.bv_val,
-                                       0, 0 );
-                               rs->sr_text = "access to naming attributes (old) not allowed";
-                               rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
-                               goto done;
-                       }
-
                        /* Apply modification */
-                       mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
-                               + 4 * sizeof ( struct berval ) );
+                       mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications ) );
                        mod_tmp->sml_desc = desc;
-                       mod_tmp->sml_values = ( BerVarray )(mod_tmp+1);
-                       mod_tmp->sml_values[0] = old_rdn[d_cnt]->la_value;
+                       mod_tmp->sml_values = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
+                       ber_dupbv( &mod_tmp->sml_values[0], &old_rdn[d_cnt]->la_value );
                        mod_tmp->sml_values[1].bv_val = NULL;
                        if( desc->ad_type->sat_equality->smr_normalize) {
-                               mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
+                               mod_tmp->sml_nvalues = ( BerVarray )ch_malloc( 2 * sizeof( struct berval ) );
                                (void) (*desc->ad_type->sat_equality->smr_normalize)(
                                        SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
                                        desc->ad_type->sat_syntax,
                                        desc->ad_type->sat_equality,
                                        &mod_tmp->sml_values[0],
-                                       &mod_tmp->sml_nvalues[0], op->o_tmpmemctx );
+                                       &mod_tmp->sml_nvalues[0], NULL );
                                mod_tmp->sml_nvalues[1].bv_val = NULL;
                        } else {
                                mod_tmp->sml_nvalues = NULL;
                        }
                        mod_tmp->sml_op = LDAP_MOD_DELETE;
                        mod_tmp->sml_flags = SLAP_MOD_INTERNAL;
-                       mod_tmp->sml_next = mod;
-                       mod = mod_tmp;
+                       mod_tmp->sml_next = op->orr_modlist;
+                       op->orr_modlist = mod_tmp;
                }
        }
        
 done:
 
+#if 0
+       /* should be done by backend */
        if ( rs->sr_err == LDAP_SUCCESS && !repl_user ) {
-               slap_mods_opattrs( op, &mod, 1 );
+               slap_mods_opattrs( op, &op->orr_modlist, 1 );
        }
+#endif
 
        /* LDAP v2 supporting correct attribute handling. */
-       if ( rs->sr_err != LDAP_SUCCESS && mod != NULL ) {
+       if ( rs->sr_err != LDAP_SUCCESS && op->orr_modlist != NULL ) {
                Modifications *tmp;
-               for ( ; mod; mod = tmp ) {
-                       tmp = mod->sml_next;
-                       ch_free( mod );
-               }
-       }
-
-       *pmod = mod;
-
-       return rs->sr_err;
-}
 
-void
-slap_modrdn2mods_free( Modifications *mod )
-{
-       Modifications *tmp;
-
-       for ( ; mod; mod = tmp ) {
-               tmp = mod->sml_next;
-               /* slap_modrdn2mods does things one way,
-                * slap_mods_opattrs does it differently
-                */
-               if ( mod->sml_op != SLAP_MOD_SOFTADD &&
-                       mod->sml_op != LDAP_MOD_DELETE )
-               {
-                       break;
-               }
-
-               if ( mod->sml_nvalues ) {
-                       free( mod->sml_nvalues[0].bv_val );
+               for ( ; op->orr_modlist != NULL; op->orr_modlist = tmp ) {
+                       tmp = op->orr_modlist->sml_next;
+                       ch_free( op->orr_modlist );
                }
+       }
 
-               free( mod );
+       if ( new_rdn != NULL ) {
+               ldap_rdnfree_x( new_rdn, op->o_tmpmemctx );
+       }
+       if ( old_rdn != NULL ) {
+               ldap_rdnfree_x( old_rdn, op->o_tmpmemctx );
        }
 
-       slap_mods_free( mod, 1 );
+       return rs->sr_err;
 }
 
index 1020d070671249dbf26a725c18ca392611ca715e..1add952aaca5d4a3132df72e348c656cae448c1e 100644 (file)
@@ -1024,13 +1024,7 @@ LDAP_SLAPD_F (int) filter_matched_values(
  */
 LDAP_SLAPD_F (int) slap_modrdn2mods LDAP_P((
        Operation       *op,
-       SlapReply       *rs,
-       Entry           *e,
-       LDAPRDN         oldrdn,
-       LDAPRDN         newrdn,
-       Modifications   **pmod ));
-
-LDAP_SLAPD_F (void) slap_modrdn2mods_free LDAP_P(( Modifications *mod ));
+       SlapReply       *rs ));
 
 /*
  * modify.c
index bb6a91ff517b4d5e44d7a78cf798c4692d2c4e0d..1a2774def5e82135f42608e61e5203e3d04c2ecd 100644 (file)
@@ -193,7 +193,7 @@ LDAP_BEGIN_DECL
 #define ATTR_CHAR(c)   ( DESC_CHAR((c)) || OID_SEPARATOR(c) )
 
 #define AD_LEADCHAR(c) ( ATTR_LEADCHAR(c) )
-#define AD_CHAR(c)             ( ATTR_CHAR(c) || (c) == ';' )
+#define AD_CHAR(c)             ( ATTR_CHAR(c) || (c) == ';' || (c) == '=' || (c) == '*' )
 
 #define SLAP_NUMERIC(c) ( ASCII_DIGIT(c) || ASCII_SPACE(c) )
 
@@ -1909,6 +1909,7 @@ typedef struct req_modrdn_s {
        struct berval *rs_newSup;
        struct berval *rs_nnewSup;
        int rs_deleteoldrdn;
+       Modifications *rs_modlist;
 } req_modrdn_s;
 
 typedef struct req_add_s {
@@ -2421,6 +2422,7 @@ typedef struct slap_op {
 #define orr_newSup oq_modrdn.rs_newSup
 #define orr_nnewSup oq_modrdn.rs_nnewSup
 #define orr_deleteoldrdn oq_modrdn.rs_deleteoldrdn
+#define orr_modlist oq_modrdn.rs_modlist
 
 #define orc_ava oq_compare.rs_ava
 #define ora_e oq_add.rs_e
index 1ca0e39eedeaf249838db5ede1093c130b49a5c9..1accaf523eebb230ff6be484bf80cd0189ced34e 100644 (file)
@@ -342,6 +342,7 @@ slapi_int_connection_done_pb( Slapi_PBlock *pb )
                        op->o_tmpfree( op->orr_nnewSup->bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( op->orr_nnewSup, op->o_tmpmemctx );
                }
+               slap_mods_free( op->orr_modlist, 1 );
                break;
        case LDAP_REQ_ADD:
                slap_mods_free( op->ora_modlist, 0 );
@@ -863,6 +864,7 @@ slapi_rename_internal_set_pb( Slapi_PBlock *pb,
        slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID,    (void *)uniqueid );
        slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY,    (void *)plugin_identity );
        slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS,      (void *)&operation_flags );
+       slap_modrdn2mods( pb->pb_op, pb->pb_rs );
        slapi_int_set_operation_dn( pb );
 }
 
index c314172878389990800ee67fea7204e221941a31..ec4b0ed18cfc5fe6cc3cc976fcb83d88cf2f9569 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2002-2005 The OpenLDAP Foundation.
+ * Copyright 2002-2006 The OpenLDAP Foundation.
  * Portions Copyright 1997,2002-2003 IBM Corporation.
  * All rights reserved.
  *
@@ -615,14 +615,22 @@ pblock_get( Slapi_PBlock *pb, int param, void **value )
                break;
        case SLAPI_MODIFY_MODS: {
                LDAPMod **mods = NULL;
+               Modifications *ml;
 
                pblock_get_default( pb, param, (void **)&mods );
                if ( mods == NULL && pb->pb_intop == 0 ) {
-                       if ( pb->pb_op->o_tag != LDAP_REQ_MODIFY ) {
+                       switch ( pb->pb_op->o_tag ) {
+                       case LDAP_REQ_MODIFY:
+                               ml = pb->pb_op->orm_modlist;
+                               break;
+                       case LDAP_REQ_MODRDN:
+                               ml = pb->pb_op->orr_modlist;
+                               break;
+                       defaulat:
                                rc = PBLOCK_ERROR;
                                break;
                        }
-                       mods = slapi_int_modifications2ldapmods( pb->pb_op->orm_modlist );
+                       mods = slapi_int_modifications2ldapmods( ml );
                        pblock_set_default( pb, param, (void *)mods );
                }
                *((LDAPMod ***)value) = mods;
@@ -951,6 +959,8 @@ pblock_set( Slapi_PBlock *pb, int param, void *value )
                        mlp = &pb->pb_op->orm_modlist;
                } else if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) {
                        mlp = &pb->pb_op->ora_modlist;
+               } else if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) {
+                       mlp = &pb->pb_op->orr_modlist;
                } else {
                        break;
                }
index 60e15f5e259ea27ee7ce20b6b6c94f83ba41072f..76eb4ad7399fb6c912df3d99b5d067ef2586b7ea 100644 (file)
@@ -1386,7 +1386,10 @@ syncrepl_message_to_op(
                op->orr_newrdn = prdn;
                op->orr_nnewrdn = nrdn;
                op->orr_deleteoldrdn = deleteOldRdn;
+               if ( slap_modrdn2mods( op, &rs ))
+                       goto done;
                rc = op->o_bd->be_modrdn( op, &rs );
+               slap_mods_free( op->orr_modlist, 1 );
                break;
        case LDAP_REQ_DELETE:
                rc = op->o_bd->be_delete( op, &rs );