mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-10 18:28:10 +09:00
kex: Reformat ssh_send_kex
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
13
src/kex.c
13
src/kex.c
@@ -836,7 +836,8 @@ int ssh_kex_select_methods (ssh_session session)
|
||||
/* this function only sends the predefined set of kex methods */
|
||||
int ssh_send_kex(ssh_session session, int server_kex)
|
||||
{
|
||||
struct ssh_kex_struct *kex = (server_kex ? &session->next_crypto->server_kex :
|
||||
struct ssh_kex_struct *kex = (server_kex ?
|
||||
&session->next_crypto->server_kex :
|
||||
&session->next_crypto->client_kex);
|
||||
ssh_string str = NULL;
|
||||
int i;
|
||||
@@ -861,10 +862,12 @@ int ssh_send_kex(ssh_session session, int server_kex)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (ssh_buffer_add_ssh_string(session->out_hashbuf, str) < 0) {
|
||||
rc = ssh_buffer_add_ssh_string(session->out_hashbuf, str);
|
||||
if (rc < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (ssh_buffer_add_ssh_string(session->out_buffer, str) < 0) {
|
||||
rc = ssh_buffer_add_ssh_string(session->out_buffer, str);
|
||||
if (rc < 0) {
|
||||
goto error;
|
||||
}
|
||||
SSH_STRING_FREE(str);
|
||||
@@ -879,12 +882,14 @@ int ssh_send_kex(ssh_session session, int server_kex)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
||||
rc = ssh_packet_send(session);
|
||||
if (rc == SSH_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_KEXINIT sent");
|
||||
return 0;
|
||||
|
||||
error:
|
||||
ssh_buffer_reinit(session->out_buffer);
|
||||
ssh_buffer_reinit(session->out_hashbuf);
|
||||
|
||||
Reference in New Issue
Block a user