Commit 2e2c8666 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Ondřej Kuzník
Browse files

There might be errors before we save the operation in c_ops

parent b6b3f35a
......@@ -55,7 +55,7 @@ request_bind( Operation *op )
} else if ( version != LDAP_VERSION3 ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
operation_send_reject(
op, LDAP_PROTOCOL_ERROR, "LDAP version unsupported" );
op, LDAP_PROTOCOL_ERROR, "LDAP version unsupported", 1 );
ber_free( copy, 0 );
return 0;
}
......@@ -286,7 +286,7 @@ client_bind( void *ctx, void *arg )
Debug( LDAP_DEBUG_STATS, "client_bind: "
"no available connection found\n" );
operation_send_reject(
op, LDAP_UNAVAILABLE, "no connections available" );
op, LDAP_UNAVAILABLE, "no connections available", 1 );
return NULL;
}
......
......@@ -105,7 +105,8 @@ client_read_cb( evutil_socket_t s, short what, void *arg )
fail:
if ( op ) {
tavl_delete( &c->c_ops, op, operation_client_cmp );
operation_send_reject(
op, LDAP_OTHER, "server error or overloaded", 1 );
op->o_client = NULL;
operation_destroy( op );
}
......
......@@ -229,17 +229,25 @@ done:
}
void
operation_send_reject( Operation *op, int result, const char *msg )
operation_send_reject(
Operation *op,
int result,
const char *msg,
int send_anyway )
{
Connection *c = op->o_client;
BerElement *ber;
int found;
Debug( LDAP_DEBUG_TRACE, "operation_send_reject: "
"rejecting %s from client %lu with message: \"%s\"\n",
slap_msgtype2str( op->o_tag ), c->c_connid, msg );
ldap_pvt_thread_mutex_lock( &c->c_mutex );
found = ( tavl_delete( &c->c_ops, op, operation_client_cmp ) == op );
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
if ( !found ) {
if ( !found && !send_anyway ) {
return;
}
......@@ -268,7 +276,7 @@ void
operation_lost_upstream( Operation *op )
{
operation_send_reject( op, LDAP_UNAVAILABLE,
"connection to the remote server has been severed" );
"connection to the remote server has been severed", 0 );
}
void *
......@@ -343,6 +351,6 @@ fail:
if ( upstream ) {
ldap_pvt_thread_mutex_unlock( &upstream->c_io_mutex );
}
operation_send_reject( op, LDAP_OTHER, "internal error" );
operation_send_reject( op, LDAP_OTHER, "internal error", 0 );
return NULL;
}
......@@ -151,7 +151,7 @@ LDAP_SLAPD_F (int) operation_upstream_cmp( const void *l, const void *r );
LDAP_SLAPD_F (int) operation_client_cmp( const void *l, const void *r );
LDAP_SLAPD_F (Operation *) operation_init( Connection *c, BerElement *ber );
LDAP_SLAPD_F (void) operation_abandon( Operation *op );
LDAP_SLAPD_F (void) operation_send_reject( Operation *op, int result, const char *msg );
LDAP_SLAPD_F (void) operation_send_reject( Operation *op, int result, const char *msg, int send_anyway );
LDAP_SLAPD_F (void) operation_lost_upstream( Operation *op );
LDAP_SLAPD_F (void) operation_destroy( Operation *op );
LDAP_SLAPD_F (void *) request_process( void *ctx, void *arg );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment