Simplify abandon processing

This commit is contained in:
Ondřej Kuzník 2017-06-23 10:58:46 +01:00 committed by Ondřej Kuzník
parent 88390159a1
commit 545198c70d

View File

@ -543,21 +543,17 @@ request_abandon( Connection *c, Operation *op )
Operation *request, needle = { .o_client_connid = c->c_connid }; Operation *request, needle = { .o_client_connid = c->c_connid };
int rc = LDAP_SUCCESS; int rc = LDAP_SUCCESS;
/* parse two's complement integer */ if ( ber_decode_int( &op->o_request, &needle.o_client_msgid ) ) {
if ( !BER_BVISEMPTY( &op->o_request ) ) { Debug( LDAP_DEBUG_STATS, "request_abandon: "
unsigned char *buf = (unsigned char *)op->o_request.bv_val; "connid=%lu msgid=%d invalid integer sent in abandon request\n",
ber_len_t i; c->c_connid, op->o_client_msgid );
ber_int_t netnum = buf[0] & 0xff;
/* sign extend */ CONNECTION_UNLOCK_INCREF(c);
netnum = ( netnum ^ 0x80 ) - 0x80; operation_send_reject(
op, LDAP_PROTOCOL_ERROR, "invalid PDU received", 0 );
/* shift in the bytes */ CONNECTION_LOCK_DECREF(c);
for ( i = 1; i < op->o_request.bv_len; i++ ) { CLIENT_DESTROY(c);
netnum = ( netnum << 8 ) | buf[i]; return -1;
}
needle.o_client_msgid = netnum;
} }
request = tavl_find( c->c_ops, &needle, operation_client_cmp ); request = tavl_find( c->c_ops, &needle, operation_client_cmp );