]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/modify.c
return structuralObjectClass errors
[openldap] / servers / slapd / back-bdb / modify.c
index 7ad798b480182c77970395a904596c2dcd777880..76cf27bab87fa391d9f7203b777b1cf568eb6b08 100644 (file)
@@ -205,7 +205,7 @@ int bdb_modify_internal(
        }
 
        /* check that the entry still obeys the schema */
-       rc = entry_schema_check( op, e, save_attrs, get_manageDIT(op),
+       rc = entry_schema_check( op, e, save_attrs, get_relax(op),
                text, textbuf, textlen );
        if ( rc != LDAP_SUCCESS || op->o_noop ) {
                attrs_free( e->e_attrs );
@@ -293,6 +293,10 @@ bdb_modify( Operation *op, SlapReply *rs )
 
        int rc;
 
+#ifdef LDAP_X_TXN
+       int settle = 0;
+#endif
+
        Debug( LDAP_DEBUG_ARGS, LDAP_XSTRING(bdb_modify) ": %s\n",
                op->o_req_dn.bv_val, 0, 0 );
 
@@ -300,11 +304,15 @@ bdb_modify( Operation *op, SlapReply *rs )
        if( op->o_txnSpec ) {
                /* acquire connection lock */
                ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
-               if( op->o_conn->c_txn == 0 ) {
+               if( op->o_conn->c_txn == CONN_TXN_INACTIVE ) {
                        rs->sr_text = "invalid transaction identifier";
                        rs->sr_err = LDAP_X_TXN_ID_INVALID;
                        goto txnReturn;
+               } else if( op->o_conn->c_txn == CONN_TXN_SETTLE ) {
+                       settle=1;
+                       goto txnReturn;
                }
+
                if( op->o_conn->c_txn_backend == NULL ) {
                        op->o_conn->c_txn_backend = op->o_bd;
 
@@ -317,14 +325,16 @@ bdb_modify( Operation *op, SlapReply *rs )
                /* insert operation into transaction */
 
                rs->sr_text = "transaction specified";
-               rs->sr_err = LDAP_SUCCESS;
+               rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
 
 txnReturn:
                /* release connection lock */
                ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
 
-               send_ldap_result( op, rs );
-               return rs->sr_err;
+               if( !settle ) {
+                       send_ldap_result( op, rs );
+                       return rs->sr_err;
+               }
        }
 #endif
 
@@ -639,11 +649,11 @@ done:
                bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
        }
 
-       if( preread_ctrl != NULL ) {
+       if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) {
                slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
                slap_sl_free( *preread_ctrl, op->o_tmpmemctx );
        }
-       if( postread_ctrl != NULL ) {
+       if( postread_ctrl != NULL && (*postread_ctrl) != NULL ) {
                slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
                slap_sl_free( *postread_ctrl, op->o_tmpmemctx );
        }