packet: log disconnect code in host byte order
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
5eeac3566e
Коммит
0bb779904d
@ -43,29 +43,35 @@
|
||||
* @brief Handle a SSH_DISCONNECT packet.
|
||||
*/
|
||||
SSH_PACKET_CALLBACK(ssh_packet_disconnect_callback){
|
||||
uint32_t code;
|
||||
char *error=NULL;
|
||||
ssh_string error_s;
|
||||
(void)user;
|
||||
(void)type;
|
||||
buffer_get_u32(packet, &code);
|
||||
int rc;
|
||||
uint32_t code = 0;
|
||||
char *error = NULL;
|
||||
ssh_string error_s;
|
||||
(void)user;
|
||||
(void)type;
|
||||
|
||||
rc = buffer_get_u32(packet, &code);
|
||||
if (rc != 0) {
|
||||
code = ntohl(code);
|
||||
}
|
||||
|
||||
error_s = buffer_get_ssh_string(packet);
|
||||
if (error_s != NULL) {
|
||||
error = ssh_string_to_char(error_s);
|
||||
ssh_string_free(error_s);
|
||||
}
|
||||
SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %d:%s",code,
|
||||
error != NULL ? error : "no error");
|
||||
SSH_LOG(SSH_LOG_PACKET, "Received SSH_MSG_DISCONNECT %d:%s",
|
||||
code, error != NULL ? error : "no error");
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"Received SSH_MSG_DISCONNECT: %d:%s",code,
|
||||
error != NULL ? error : "no error");
|
||||
"Received SSH_MSG_DISCONNECT: %d:%s",
|
||||
code, error != NULL ? error : "no error");
|
||||
SAFE_FREE(error);
|
||||
|
||||
ssh_socket_close(session->socket);
|
||||
session->alive = 0;
|
||||
session->session_state= SSH_SESSION_STATE_ERROR;
|
||||
/* TODO: handle a graceful disconnect */
|
||||
return SSH_PACKET_USED;
|
||||
session->session_state = SSH_SESSION_STATE_ERROR;
|
||||
/* TODO: handle a graceful disconnect */
|
||||
return SSH_PACKET_USED;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user