mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
src: Remove enter_function() and leave_function().
This commit is contained in:
30
src/packet.c
30
src/packet.c
@@ -159,14 +159,12 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
goto error;
|
||||
}
|
||||
|
||||
enter_function();
|
||||
if (session->session_state == SSH_SESSION_STATE_ERROR)
|
||||
goto error;
|
||||
switch(session->packet_state) {
|
||||
case PACKET_STATE_INIT:
|
||||
if(receivedlen < blocksize){
|
||||
/* We didn't receive enough data to read at least one block size, give up */
|
||||
leave_function();
|
||||
return 0;
|
||||
}
|
||||
memset(&session->in_packet, 0, sizeof(PACKET));
|
||||
@@ -296,7 +294,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
receivedlen - processed,user);
|
||||
processed += rc;
|
||||
}
|
||||
leave_function();
|
||||
|
||||
return processed;
|
||||
case PACKET_STATE_PROCESSING:
|
||||
SSH_LOG(SSH_LOG_RARE, "Nested packet processing. Delaying.");
|
||||
@@ -309,7 +307,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
|
||||
|
||||
error:
|
||||
session->session_state= SSH_SESSION_STATE_ERROR;
|
||||
leave_function();
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
@@ -359,11 +357,12 @@ void ssh_packet_process(ssh_session session, uint8_t type){
|
||||
struct ssh_iterator *i;
|
||||
int r=SSH_PACKET_NOT_USED;
|
||||
ssh_packet_callbacks cb;
|
||||
enter_function();
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET, "Dispatching handler for packet type %d",type);
|
||||
if(session->packet_callbacks == NULL){
|
||||
SSH_LOG(SSH_LOG_RARE,"Packet callback is not initialized !");
|
||||
goto error;
|
||||
|
||||
return;
|
||||
}
|
||||
i=ssh_list_get_iterator(session->packet_callbacks);
|
||||
while(i != NULL){
|
||||
@@ -385,8 +384,6 @@ void ssh_packet_process(ssh_session session, uint8_t type){
|
||||
SSH_LOG(SSH_LOG_RARE,"Couldn't do anything with packet type %d",type);
|
||||
ssh_packet_send_unimplemented(session, session->recv_seq-1);
|
||||
}
|
||||
error:
|
||||
leave_function();
|
||||
}
|
||||
|
||||
/** @internal
|
||||
@@ -397,7 +394,7 @@ error:
|
||||
*/
|
||||
int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
|
||||
int r;
|
||||
enter_function();
|
||||
|
||||
r = buffer_add_u8(session->out_buffer, SSH2_MSG_UNIMPLEMENTED);
|
||||
if (r < 0) {
|
||||
return SSH_ERROR;
|
||||
@@ -407,7 +404,7 @@ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum){
|
||||
return SSH_ERROR;
|
||||
}
|
||||
r = packet_send(session);
|
||||
leave_function();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -430,23 +427,18 @@ SSH_PACKET_CALLBACK(ssh_packet_unimplemented){
|
||||
* @parse the "Type" header field of a packet and updates the session
|
||||
*/
|
||||
int ssh_packet_parse_type(ssh_session session) {
|
||||
enter_function();
|
||||
|
||||
memset(&session->in_packet, 0, sizeof(PACKET));
|
||||
if(session->in_buffer == NULL) {
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
if(buffer_get_u8(session->in_buffer, &session->in_packet.type) == 0) {
|
||||
ssh_set_error(session, SSH_FATAL, "Packet too short to read type");
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
session->in_packet.valid = 1;
|
||||
|
||||
leave_function();
|
||||
return SSH_OK;
|
||||
}
|
||||
|
||||
@@ -457,12 +449,10 @@ int ssh_packet_parse_type(ssh_session session) {
|
||||
static int ssh_packet_write(ssh_session session) {
|
||||
int rc = SSH_ERROR;
|
||||
|
||||
enter_function();
|
||||
|
||||
rc=ssh_socket_write(session->socket,
|
||||
buffer_get_rest(session->out_buffer),
|
||||
buffer_get_rest_len(session->out_buffer));
|
||||
leave_function();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -476,8 +466,6 @@ static int packet_send2(ssh_session session) {
|
||||
uint32_t finallen,payloadsize,compsize;
|
||||
uint8_t padding;
|
||||
|
||||
enter_function();
|
||||
|
||||
payloadsize = currentlen;
|
||||
#ifdef WITH_ZLIB
|
||||
if (session->current_crypto
|
||||
@@ -537,7 +525,7 @@ static int packet_send2(ssh_session session) {
|
||||
rc = SSH_ERROR;
|
||||
}
|
||||
error:
|
||||
leave_function();
|
||||
|
||||
return rc; /* SSH_OK, AGAIN or ERROR */
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user