]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/modrdn.c
sigh, the test was renamed ages ago
[openldap] / servers / slapd / back-sql / modrdn.c
index 6b22c5de490bad708f3fb552955f8e88278808a0..1c81cead296a9a68023a045965eb1983988313ed 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2005 The OpenLDAP Foundation.
+ * Copyright 1999-2006 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * Portions Copyright 2002 Pierangelo Masarati.
  * All rights reserved.
@@ -44,14 +44,11 @@ backsql_modrdn( Operation *op, SlapReply *rs )
                                *new_pdn = NULL, *new_npdn = NULL,
                                new_dn = BER_BVNULL, new_ndn = BER_BVNULL,
                                realnew_dn = BER_BVNULL;
-       LDAPRDN                 new_rdn = NULL;
-       LDAPRDN                 old_rdn = NULL;
        Entry                   r = { 0 },
                                p = { 0 },
                                n = { 0 },
                                *e = NULL;
        int                     manageDSAit = get_manageDSAit( op );
-       Modifications           *mod = NULL;
        struct berval           *newSuperior = op->oq_modrdn.rs_newSup;
        char                    *next;
  
@@ -395,49 +392,12 @@ backsql_modrdn( Operation *op, SlapReply *rs )
        }
        SQLFreeStmt( sth, SQL_DROP );
 
-       /*
-        * Get attribute type and attribute value of our new rdn,
-        * we will need to add that to our new entry
-        */
-       if ( ldap_bv2rdn( &op->oq_modrdn.rs_newrdn, &new_rdn, &next, 
-                               LDAP_DN_FORMAT_LDAP ) )
-       {
-               Debug( LDAP_DEBUG_TRACE,
-                       "   backsql_modrdn: can't figure out "
-                       "type(s)/values(s) of new_rdn\n", 
-                       0, 0, 0 );
-               rs->sr_err = LDAP_INVALID_DN_SYNTAX;
-               e = &r;
-               goto done;
-       }
+       assert( op->orr_modlist != NULL );
 
-       Debug( LDAP_DEBUG_TRACE, "backsql_modrdn: "
-               "new_rdn_type=\"%s\", new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ]->la_attr.bv_val,
-               new_rdn[ 0 ]->la_value.bv_val, 0 );
-
-       if ( op->oq_modrdn.rs_deleteoldrdn ) {
-               if ( ldap_bv2rdn( &op->o_req_dn, &old_rdn, &next,
-                                       LDAP_DN_FORMAT_LDAP ) )
-               {
-                       Debug( LDAP_DEBUG_TRACE,
-                               "   backsql_modrdn: can't figure out "
-                               "the old_rdn type(s)/value(s)\n", 
-                               0, 0, 0 );
-                       rs->sr_err = LDAP_OTHER;
-                       e = NULL;
-                       goto done;
-               }
-       }
-
-       rs->sr_err = slap_modrdn2mods( op, rs, &r, old_rdn, new_rdn, &mod );
-       if ( rs->sr_err != LDAP_SUCCESS ) {
-               e = &r;
-               goto done;
-       }
+       slap_mods_opattrs( op, &op->orr_modlist, 1 );
 
        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;
@@ -504,7 +464,6 @@ backsql_modrdn( Operation *op, SlapReply *rs )
        }
 
 done:;
-#ifdef SLAP_ACL_HONOR_DISCLOSE
        if ( e != NULL ) {
                if ( !access_allowed( op, e, slap_schema.si_ad_entry, NULL,
                                        ACL_DISCLOSE, NULL ) )
@@ -518,7 +477,6 @@ done:;
                        }
                }
        }
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
 
        /*
         * Commit only if all operations succeed
@@ -534,6 +492,7 @@ done:;
        }
 
        send_ldap_result( op, rs );
+       slap_graduate_commit_csn( op );
 
        if ( !BER_BVISNULL( &realnew_dn ) && realnew_dn.bv_val != new_dn.bv_val ) {
                ch_free( realnew_dn.bv_val );
@@ -547,19 +506,6 @@ done:;
                slap_sl_free( new_ndn.bv_val, op->o_tmpmemctx );
        }
        
-       /* LDAP v2 supporting correct attribute handling. */
-       if ( new_rdn != NULL ) {
-               ldap_rdnfree( new_rdn );
-       }
-
-       if ( old_rdn != NULL ) {
-               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 );
        }