+ ber_init2( ber, op->ore_reqdata, 0 );
+
+ tag = ber_scanf( ber, "{" /*}*/ );
+ if( tag == LBER_ERROR ) {
+ rs->sr_text = "request data decoding error";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ tag = ber_peek_tag( ber, &len );
+ if( tag == LBER_BOOLEAN ) {
+ tag = ber_scanf( ber, "b", &commit );
+ if( tag == LBER_ERROR ) {
+ rs->sr_text = "request data decoding error";
+ return LDAP_PROTOCOL_ERROR;
+ }
+ }
+
+ tag = ber_scanf( ber, /*{*/ "m}", &txnid );
+ if( tag == LBER_ERROR ) {
+ rs->sr_text = "request data decoding error";
+ return LDAP_PROTOCOL_ERROR;
+ }
+
+ if( txnid.bv_len ) {
+ rs->sr_text = "invalid transaction identifier";
+ return LDAP_X_TXN_ID_INVALID;
+ }
+
+ /* acquire connection lock */
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+
+ if( op->o_conn->c_txn != CONN_TXN_SPECIFY ) {
+ rs->sr_text = "invalid transaction identifier";
+ rc = LDAP_X_TXN_ID_INVALID;
+ goto done;
+ }
+ op->o_conn->c_txn = CONN_TXN_SETTLE;
+
+ if( commit ) {
+ if ( op->o_abandon ) {
+ }
+
+ if( LDAP_STAILQ_EMPTY(&op->o_conn->c_txn_ops) ) {
+ /* no updates to commit */
+ rs->sr_text = "no updates to commit";
+ rc = LDAP_OPERATIONS_ERROR;
+ goto settled;
+ }
+
+ rs->sr_text = "not yet implemented";
+ rc = LDAP_UNWILLING_TO_PERFORM;
+
+ } else {
+ rs->sr_text = "transaction aborted";
+ rc = LDAP_SUCCESS;;
+ }
+
+drain:
+ /* drain txn ops list */
+
+settled:
+ assert( LDAP_STAILQ_EMPTY(&op->o_conn->c_txn_ops) );
+ assert( op->o_conn->c_txn == CONN_TXN_SETTLE );
+ op->o_conn->c_txn = CONN_TXN_INACTIVE;
+ op->o_conn->c_txn_backend = NULL;
+
+done:
+ /* release connection lock */
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ return rc;