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

Fix pinned operation forwarding

parent 2ba83368
......@@ -476,6 +476,7 @@ handle_bind_response(
if ( client->c_state == LLOAD_C_BINDING ) {
switch ( result ) {
case LDAP_SASL_BIND_IN_PROGRESS:
op->o_saved_msgid = op->o_client_msgid;
op->o_client_msgid = 0;
rc = tavl_insert( &client->c_ops, op, operation_client_cmp,
avl_dup_error );
......
......@@ -306,6 +306,7 @@ struct LloadOperation {
unsigned long o_client_connid;
int o_client_live, o_client_refcnt;
ber_int_t o_client_msgid;
ber_int_t o_saved_msgid;
LloadConnection *o_upstream;
unsigned long o_upstream_connid;
......
......@@ -696,6 +696,14 @@ operation_send_reject_locked(
goto done;
}
if ( op->o_client_msgid == 0 ) {
assert( op->o_saved_msgid == 0 && op->o_pin_id );
Debug( LDAP_DEBUG_TRACE, "operation_send_reject_locked: "
"operation pin=%lu is just a pin, not sending\n",
op->o_pin_id );
goto done;
}
CONNECTION_UNLOCK_INCREF(c);
ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
......
......@@ -29,9 +29,20 @@ forward_response( LloadConnection *client, LloadOperation *op, BerElement *ber )
{
BerElement *output;
BerValue response, controls = BER_BVNULL;
ber_int_t msgid;
ber_tag_t tag, response_tag;
ber_len_t len;
CONNECTION_LOCK(client);
if ( op->o_client_msgid ) {
msgid = op->o_client_msgid;
} else {
assert( op->o_pin_id );
msgid = op->o_saved_msgid;
op->o_saved_msgid = 0;
}
CONNECTION_UNLOCK(client);
response_tag = ber_skip_element( ber, &response );
tag = ber_peek_tag( ber, &len );
......@@ -41,8 +52,7 @@ forward_response( LloadConnection *client, LloadOperation *op, BerElement *ber )
Debug( LDAP_DEBUG_TRACE, "forward_response: "
"%s to client connid=%lu request msgid=%d\n",
lload_msgtype2str( response_tag ), op->o_client_connid,
op->o_client_msgid );
lload_msgtype2str( response_tag ), op->o_client_connid, msgid );
ldap_pvt_thread_mutex_lock( &client->c_io_mutex );
output = client->c_pendingber;
......@@ -54,7 +64,7 @@ forward_response( LloadConnection *client, LloadOperation *op, BerElement *ber )
client->c_pendingber = output;
ber_printf( output, "t{titOtO}", LDAP_TAG_MESSAGE,
LDAP_TAG_MSGID, op->o_client_msgid,
LDAP_TAG_MSGID, msgid,
response_tag, &response,
LDAP_TAG_CONTROLS, BER_BV_OPTIONAL( &controls ) );
......
Markdown is supported
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