1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

server: handle keepalive@openssh.com global requests

This commit is contained in:
Aris Adamantiadis
2016-03-14 22:28:03 +01:00
parent 7c2db045a8
commit 0b9804a95b
2 changed files with 10 additions and 0 deletions

View File

@@ -208,6 +208,7 @@ enum ssh_global_requests_e {
SSH_GLOBAL_REQUEST_UNKNOWN=0, SSH_GLOBAL_REQUEST_UNKNOWN=0,
SSH_GLOBAL_REQUEST_TCPIP_FORWARD, SSH_GLOBAL_REQUEST_TCPIP_FORWARD,
SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD, SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD,
SSH_GLOBAL_REQUEST_KEEPALIVE
}; };
enum ssh_publickey_state_e { enum ssh_publickey_state_e {

View File

@@ -1396,6 +1396,15 @@ SSH_PACKET_CALLBACK(ssh_packet_global_request){
} else { } else {
ssh_message_reply_default(msg); ssh_message_reply_default(msg);
} }
} else if(strcmp(request, "keepalive@openssh.com") == 0) {
msg->global_request.type = SSH_GLOBAL_REQUEST_KEEPALIVE;
msg->global_request.want_reply = want_reply;
SSH_LOG(SSH_LOG_PROTOCOL, "Received keepalive@openssh.com %d", want_reply);
if(ssh_callbacks_exists(session->common.callbacks, global_request_function)) {
session->common.callbacks->global_request_function(session, msg, session->common.callbacks->userdata);
} else {
ssh_message_global_request_reply_success(msg, 0);
}
} else { } else {
SSH_LOG(SSH_LOG_PROTOCOL, "UNKNOWN SSH_MSG_GLOBAL_REQUEST %s %d", request, want_reply); SSH_LOG(SSH_LOG_PROTOCOL, "UNKNOWN SSH_MSG_GLOBAL_REQUEST %s %d", request, want_reply);
rc = SSH_PACKET_NOT_USED; rc = SSH_PACKET_NOT_USED;