client: Reformat ssh_client_connection_callback

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:
Jakub Jelen
2023-03-16 11:37:07 +01:00
parent 1529bbd7ac
commit e9741edcde

View File

@@ -386,7 +386,7 @@ static void ssh_client_connection_callback(ssh_session session)
{ {
int rc; int rc;
switch(session->session_state) { switch (session->session_state) {
case SSH_SESSION_STATE_NONE: case SSH_SESSION_STATE_NONE:
case SSH_SESSION_STATE_CONNECTING: case SSH_SESSION_STATE_CONNECTING:
break; break;
@@ -431,10 +431,10 @@ static void ssh_client_connection_callback(ssh_session session)
/* TODO: This state should disappear in favor of get_key handle */ /* TODO: This state should disappear in favor of get_key handle */
break; break;
case SSH_SESSION_STATE_KEXINIT_RECEIVED: case SSH_SESSION_STATE_KEXINIT_RECEIVED:
set_status(session,0.6f); set_status(session, 0.6f);
ssh_list_kex(&session->next_crypto->server_kex); ssh_list_kex(&session->next_crypto->server_kex);
if (session->next_crypto->client_kex.methods[0] == NULL) { if (session->next_crypto->client_kex.methods[0] == NULL) {
/* in rekeying state if next_crypto client_kex is empty */ /* in rekeying state if next_crypto client_kex might be empty */
rc = ssh_set_client_kex(session); rc = ssh_set_client_kex(session);
if (rc != SSH_OK) { if (rc != SSH_OK) {
goto error; goto error;
@@ -446,15 +446,15 @@ static void ssh_client_connection_callback(ssh_session session)
} }
if (ssh_kex_select_methods(session) == SSH_ERROR) if (ssh_kex_select_methods(session) == SSH_ERROR)
goto error; goto error;
set_status(session,0.8f); set_status(session, 0.8f);
session->session_state=SSH_SESSION_STATE_DH; session->session_state = SSH_SESSION_STATE_DH;
if (dh_handshake(session) == SSH_ERROR) { if (dh_handshake(session) == SSH_ERROR) {
goto error; goto error;
} }
FALL_THROUGH; FALL_THROUGH;
case SSH_SESSION_STATE_DH: case SSH_SESSION_STATE_DH:
if(session->dh_handshake_state==DH_STATE_FINISHED){ if (session->dh_handshake_state == DH_STATE_FINISHED) {
set_status(session,1.0f); set_status(session, 1.0f);
session->connected = 1; session->connected = 1;
if (session->flags & SSH_SESSION_FLAG_AUTHENTICATED) if (session->flags & SSH_SESSION_FLAG_AUTHENTICATED)
session->session_state = SSH_SESSION_STATE_AUTHENTICATED; session->session_state = SSH_SESSION_STATE_AUTHENTICATED;
@@ -467,14 +467,15 @@ static void ssh_client_connection_callback(ssh_session session)
case SSH_SESSION_STATE_ERROR: case SSH_SESSION_STATE_ERROR:
goto error; goto error;
default: default:
ssh_set_error(session,SSH_FATAL,"Invalid state %d",session->session_state); ssh_set_error(session, SSH_FATAL, "Invalid state %d",
session->session_state);
} }
return; return;
error: error:
ssh_socket_close(session->socket); ssh_socket_close(session->socket);
session->alive = 0; session->alive = 0;
session->session_state=SSH_SESSION_STATE_ERROR; session->session_state = SSH_SESSION_STATE_ERROR;
} }