mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 02:39:48 +09:00
Add direct-tcpip channel open request callback support
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
8c8d3ceef7
commit
18e7423e70
@@ -204,8 +204,37 @@ static int ssh_execute_server_request(ssh_session session, ssh_message msg)
|
||||
ssh_message_reply_default(msg);
|
||||
}
|
||||
|
||||
return SSH_OK;
|
||||
} else if (msg->channel_request_open.type ==
|
||||
SSH_CHANNEL_DIRECT_TCPIP &&
|
||||
ssh_callbacks_exists(
|
||||
session->server_callbacks,
|
||||
channel_open_request_direct_tcpip_function)) {
|
||||
channel = session->server_callbacks
|
||||
->channel_open_request_direct_tcpip_function(
|
||||
session,
|
||||
msg->channel_request_open.destination,
|
||||
msg->channel_request_open.destination_port,
|
||||
msg->channel_request_open.originator,
|
||||
msg->channel_request_open.originator_port,
|
||||
session->server_callbacks->userdata);
|
||||
if (channel != NULL) {
|
||||
rc = ssh_message_channel_request_open_reply_accept_channel(
|
||||
msg,
|
||||
channel);
|
||||
if (rc != SSH_OK) {
|
||||
SSH_LOG(SSH_LOG_TRACE,
|
||||
"Failed to send reply for accepting a channel "
|
||||
"open");
|
||||
}
|
||||
return SSH_OK;
|
||||
} else {
|
||||
ssh_message_reply_default(msg);
|
||||
}
|
||||
|
||||
return SSH_OK;
|
||||
}
|
||||
|
||||
break;
|
||||
case SSH_REQUEST_CHANNEL:
|
||||
channel = msg->channel_request.channel;
|
||||
|
||||
Reference in New Issue
Block a user