1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

Made packet handlers independant of session buffer

This commit is contained in:
Aris Adamantiadis
2010-01-24 22:43:52 +01:00
parent 3465b592e7
commit 3ac62dda51

View File

@@ -175,8 +175,8 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
msg->auth_request.method = SSH_AUTH_METHOD_PASSWORD; msg->auth_request.method = SSH_AUTH_METHOD_PASSWORD;
SAFE_FREE(service_c); SAFE_FREE(service_c);
SAFE_FREE(method_c); SAFE_FREE(method_c);
buffer_get_u8(session->in_buffer, &tmp); buffer_get_u8(packet, &tmp);
pass = buffer_get_ssh_string(session->in_buffer); pass = buffer_get_ssh_string(packet);
if (pass == NULL) { if (pass == NULL) {
goto error; goto error;
} }
@@ -197,12 +197,12 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
msg->auth_request.method = SSH_AUTH_METHOD_PUBLICKEY; msg->auth_request.method = SSH_AUTH_METHOD_PUBLICKEY;
SAFE_FREE(method_c); SAFE_FREE(method_c);
buffer_get_u8(session->in_buffer, &has_sign); buffer_get_u8(packet, &has_sign);
algo = buffer_get_ssh_string(session->in_buffer); algo = buffer_get_ssh_string(packet);
if (algo == NULL) { if (algo == NULL) {
goto error; goto error;
} }
publickey = buffer_get_ssh_string(session->in_buffer); publickey = buffer_get_ssh_string(packet);
if (publickey == NULL) { if (publickey == NULL) {
string_free(algo); string_free(algo);
algo = NULL; algo = NULL;
@@ -224,7 +224,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request){
ssh_string sign = NULL; ssh_string sign = NULL;
ssh_buffer digest = NULL; ssh_buffer digest = NULL;
sign = buffer_get_ssh_string(session->in_buffer); sign = buffer_get_ssh_string(packet);
if(sign == NULL) { if(sign == NULL) {
ssh_log(session, SSH_LOG_PACKET, "Invalid signature packet from peer"); ssh_log(session, SSH_LOG_PACKET, "Invalid signature packet from peer");
msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR; msg->auth_request.signature_state = SSH_PUBLICKEY_STATE_ERROR;
@@ -334,7 +334,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open){
} }
if (strcmp(type_c,"direct-tcpip") == 0) { if (strcmp(type_c,"direct-tcpip") == 0) {
destination = buffer_get_ssh_string(session->in_buffer); destination = buffer_get_ssh_string(packet);
if (destination == NULL) { if (destination == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
goto error; goto error;
@@ -347,10 +347,10 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_open){
} }
string_free(destination); string_free(destination);
buffer_get_u32(session->in_buffer, &destination_port); buffer_get_u32(packet, &destination_port);
msg->channel_request_open.destination_port = ntohl(destination_port); msg->channel_request_open.destination_port = ntohl(destination_port);
originator = buffer_get_ssh_string(session->in_buffer); originator = buffer_get_ssh_string(packet);
if (originator == NULL) { if (originator == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
goto error; goto error;