Commits (8)
......@@ -102,10 +102,8 @@ do_abandon( Operation *op, SlapReply *rs )
|| o->o_tag == LDAP_REQ_ABANDON ) {
msg = "cannot be abandoned";
#if 0 /* Would break o_abandon used as "suppress response" flag, ITS#6138 */
} else if ( o->o_abandon ) {
msg = "already being abandoned";
#endif
} else {
msg = "found";
......
......@@ -141,7 +141,7 @@ void asyncmeta_free_op(Operation *op)
Debug( LDAP_DEBUG_TRACE, "==> asyncmeta_free_op : other message type" );
}
connection_op_finish( op );
connection_op_finish( op, 1 );
slap_op_free( op, op->o_threadctx );
}
......
......@@ -54,18 +54,15 @@ ldap_back_extended_one( Operation *op, SlapReply *rs, ldap_back_exop_f exop )
* called twice; maybe we could avoid the
* ldap_back_dobind() call inside each extended()
* call ... */
if ( !ldap_back_dobind( &lc, op, rs, LDAP_BACK_SENDERR ) ) {
return -1;
if ( !ldap_back_dobind( &lc, op, rs, LDAP_BACK_DONTSEND ) ) {
return rs->sr_err;
}
ctrls = oldctrls = op->o_ctrls;
if ( ldap_back_controls_add( op, rs, lc, &ctrls ) )
{
op->o_ctrls = oldctrls;
send_ldap_extended( op, rs );
rs->sr_text = NULL;
/* otherwise frontend resends result */
rc = rs->sr_err = SLAPD_ABANDON;
rc = rs->sr_err;
goto done;
}
......@@ -242,11 +239,22 @@ retry:
}
}
if ( text ) {
/* copy to tmpmem, doesn't need to be freed */
rs->sr_text = op->o_tmpalloc( strlen( text ) + 1, op->o_tmpmemctx );
strcpy( rs->sr_text, text );
ch_free( text );
}
if ( rs->sr_matched )
rs->sr_flags |= REP_MATCHED_MUSTBEFREED;
if ( rs->sr_ctrls )
rs->sr_flags |= REP_CTRLS_MUSTBEFREED;
if ( rc != LDAP_SUCCESS ) {
rs->sr_err = slap_map_api2result( rs );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_SENDERR ) ) {
if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_DONTSEND ) ) {
goto retry;
}
}
......@@ -255,11 +263,6 @@ retry:
ldap_back_quarantine( op, rs );
}
if ( text ) rs->sr_text = text;
send_ldap_extended( op, rs );
/* otherwise frontend resends result */
rc = rs->sr_err = SLAPD_ABANDON;
} else if ( LDAP_BACK_QUARANTINE( li ) ) {
ldap_back_quarantine( op, rs );
}
......@@ -273,22 +276,6 @@ retry:
op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
}
/* these have to be freed anyway... */
if ( rs->sr_matched ) {
free( (char *)rs->sr_matched );
rs->sr_matched = NULL;
}
if ( rs->sr_ctrls ) {
ldap_controls_free( rs->sr_ctrls );
rs->sr_ctrls = NULL;
}
if ( text ) {
free( text );
rs->sr_text = NULL;
}
/* in case, cleanup handler */
if ( lc == NULL ) {
*lcp = NULL;
......@@ -363,7 +350,7 @@ retry:
rs->sr_err = slap_map_api2result( rs );
if ( rs->sr_err == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_SENDERR ) ) {
if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_DONTSEND ) ) {
goto retry;
}
}
......@@ -371,12 +358,6 @@ retry:
if ( LDAP_BACK_QUARANTINE( li ) ) {
ldap_back_quarantine( op, rs );
}
if ( text ) rs->sr_text = text;
send_ldap_extended( op, rs );
/* otherwise frontend resends result */
rc = rs->sr_err = SLAPD_ABANDON;
} else if ( LDAP_BACK_QUARANTINE( li ) ) {
ldap_back_quarantine( op, rs );
}
......@@ -385,21 +366,16 @@ retry:
ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_EXTENDED ], 1 );
ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
/* these have to be freed anyway... */
if ( rs->sr_matched ) {
free( (char *)rs->sr_matched );
rs->sr_matched = NULL;
}
if ( rs->sr_ctrls ) {
ldap_controls_free( rs->sr_ctrls );
rs->sr_ctrls = NULL;
}
if ( text ) {
free( text );
rs->sr_text = NULL;
/* copy to tmpmem, doesn't need to be freed */
rs->sr_text = op->o_tmpalloc( strlen( text ) + 1, op->o_tmpmemctx );
strcpy( rs->sr_text, text );
ch_free( text );
}
if ( rs->sr_matched )
rs->sr_flags |= REP_MATCHED_MUSTBEFREED;
if ( rs->sr_ctrls )
rs->sr_flags |= REP_CTRLS_MUSTBEFREED;
/* in case, cleanup handler */
if ( lc == NULL ) {
......
......@@ -1213,8 +1213,6 @@ nochange:
send_ldap_result( op, rs );
}
rs->sr_err = LDAP_SUCCESS;
done:
if ( cb.sc_private ) {
/* remove our writewait callback */
......
......@@ -113,13 +113,8 @@ int cancel_extop( Operation *op, SlapReply *rs )
rc = LDAP_OPERATIONS_ERROR;
rs->sr_text = "message ID already being cancelled";
#if 0
} else if ( o->o_abandon ) {
/* TODO: Would this break something when
* o_abandon="suppress response"? (ITS#6138)
*/
rc = LDAP_TOO_LATE;
#endif
} else {
rc = LDAP_SUCCESS;
......
......@@ -985,7 +985,7 @@ conn_counter_init( Operation *op, void *ctx )
}
void
connection_op_finish( Operation *op )
connection_op_finish( Operation *op, int lock )
{
Connection *conn = op->o_conn;
void *memctx_null = NULL;
......@@ -994,7 +994,8 @@ connection_op_finish( Operation *op )
INCR_OP_COMPLETED( opidx );
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
if ( lock )
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
if ( op->o_tag == LDAP_REQ_BIND && conn->c_conn_state == SLAP_C_BINDING )
conn->c_conn_state = SLAP_C_ACTIVE;
......@@ -1006,7 +1007,8 @@ connection_op_finish( Operation *op )
conn->c_n_ops_executing--;
conn->c_n_ops_completed++;
connection_resched( conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
if ( lock )
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
}
static void *
......
......@@ -225,7 +225,8 @@ fe_extended( Operation *op, SlapReply *rs )
rs->sr_err = (ext->ext_main)( op, rs );
if( rs->sr_err != SLAPD_ABANDON ) {
if( rs->sr_err != SLAPD_ABANDON && rs->sr_err != SLAPD_ASYNCOP &&
rs->sr_err != SLAPD_NO_REPLY ) {
if ( rs->sr_err == LDAP_REFERRAL && rs->sr_ref == NULL ) {
rs->sr_ref = referral_rewrite( default_referral,
NULL, NULL, LDAP_SCOPE_DEFAULT );
......
......@@ -711,7 +711,6 @@ retcode_entry_response( Operation *op, SlapReply *rs, BackendInfo *bi, Entry *e
return rs->sr_err = SLAPD_DISCONNECT;
}
op->o_abandon = 1;
return rs->sr_err;
}
......
......@@ -2890,9 +2890,6 @@ syncprov_detach_op( Operation *op, syncops *so, slap_overinst *on )
op->o_conn->c_n_ops_completed--;
LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op2, o_next );
so->s_flags |= PS_IS_DETACHED;
/* Prevent anyone else from trying to send a result for this op */
op->o_abandon = 1;
}
static int
......@@ -3032,9 +3029,8 @@ syncprov_search_response( Operation *op, SlapReply *rs )
if ( ss->ss_so->s_res )
syncprov_qstart( ss->ss_so );
ldap_pvt_thread_mutex_unlock( &ss->ss_so->s_mutex );
return SLAPD_NO_REPLY;
}
return LDAP_SUCCESS;
}
}
......
......@@ -812,7 +812,7 @@ LDAP_SLAPD_F (int) connection_write LDAP_P((ber_socket_t s));
LDAP_SLAPD_F (void) connection_write_resume LDAP_P((Connection *c));
LDAP_SLAPD_F (void) connection_op_finish LDAP_P((
Operation *op ));
Operation *op, int lock ));
LDAP_SLAPD_F (unsigned long) connections_nextid(void);
......
......@@ -159,6 +159,9 @@ LDAP_BEGIN_DECL
/* pseudo error code indicating async operation */
#define SLAPD_ASYNCOP (-1027)
/* pseudo error code to suppress frontend response */
#define SLAPD_NO_REPLY (-1028)
/* We assume "C" locale, that is US-ASCII */
#define ASCII_SPACE(c) ( (c) == ' ' )
#define ASCII_LOWER(c) ( (c) >= 'a' && (c) <= 'z' )
......
......@@ -170,7 +170,7 @@ if test $RC != 0 ; then
fi
# This usually propagates immediately
sleep 1
sleep $SLEEP1
$LDAPSEARCH -H $URI2 -b "$BABSDN" > $TESTOUT 2>&1
RC=$?
......