aboutsummaryrefslogtreecommitdiff
path: root/src/messages.c
diff options
context:
space:
mode:
authorLoïc Michaux <lmichaux@wallix.com>2014-03-07 15:19:44 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-04-09 11:13:57 +0200
commitefe785e711e1fe8c66dc120b741d1e560ef556db (patch)
tree1ead0db8cd54cd2a1f073f76f52eb3e48407b084 /src/messages.c
parent48aca98cd52f439acf2af9faa27d7d6c7a4735c5 (diff)
downloadlibssh-efe785e711e1fe8c66dc120b741d1e560ef556db.tar.gz
libssh-efe785e711e1fe8c66dc120b741d1e560ef556db.tar.xz
libssh-efe785e711e1fe8c66dc120b741d1e560ef556db.zip
direct-tcpip and forwarded-tcpip callbacks
Diffstat (limited to 'src/messages.c')
-rw-r--r--src/messages.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/messages.c b/src/messages.c
index e7bf39f0..c051c08a 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -162,6 +162,38 @@ static int ssh_execute_server_request(ssh_session session, ssh_message 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);
+ return SSH_OK;
+ } else {
+ ssh_message_reply_default(msg);
+ }
+ return SSH_OK;
+ }
+ else if (msg->channel_request_open.type == SSH_CHANNEL_FORWARDED_TCPIP &&
+ ssh_callbacks_exists(session->server_callbacks, channel_open_request_forwarded_tcpip_function)) {
+ channel = session->server_callbacks->channel_open_request_forwarded_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);
+ return SSH_OK;
+ } else {
+ ssh_message_reply_default(msg);
+ }
+ return SSH_OK;
+ }
break;
case SSH_REQUEST_CHANNEL:
channel = msg->channel_request.channel;