summaryrefslogtreecommitdiffstats
path: root/src/remmina_protocol_widget.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:19:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:19:20 +0000
commit40dbff2608bd68130462f45c02495db7e1acac6b (patch)
tree062faaba0bdc95f0103e22dca82461279694146b /src/remmina_protocol_widget.c
parentAdding debian version 1.4.34+dfsg-1. (diff)
downloadremmina-40dbff2608bd68130462f45c02495db7e1acac6b.tar.xz
remmina-40dbff2608bd68130462f45c02495db7e1acac6b.zip
Merging upstream version 1.4.35+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/remmina_protocol_widget.c')
-rw-r--r--src/remmina_protocol_widget.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c
index 7becda0..c8362a9 100644
--- a/src/remmina_protocol_widget.c
+++ b/src/remmina_protocol_widget.c
@@ -1168,6 +1168,44 @@ gchar *remmina_protocol_widget_start_direct_tunnel(RemminaProtocolWidget *gp, gi
g_ptr_array_add(gp->priv->ssh_tunnels, tunnel);
+
+ //try startup command
+ ssh_channel channel;
+ int rc;
+ const gchar* tunnel_command = remmina_file_get_string(gp->priv->remmina_file, "ssh_tunnel_command");
+ if (tunnel_command != NULL){
+ channel = ssh_channel_new(REMMINA_SSH(tunnel)->session);
+ if (channel == NULL) return g_strdup_printf("127.0.0.1:%i", remmina_pref.sshtunnel_port);
+
+ rc = ssh_channel_open_session(channel);
+ if (rc != SSH_OK)
+ {
+ ssh_channel_free(channel);
+ return g_strdup_printf("127.0.0.1:%i", remmina_pref.sshtunnel_port);
+ }
+ rc = ssh_channel_request_exec(channel, tunnel_command);
+ if (rc != SSH_OK)
+ {
+ ssh_channel_close(channel);
+ ssh_channel_free(channel);
+ return g_strdup_printf("127.0.0.1:%i", remmina_pref.sshtunnel_port);
+ }
+ struct timeval timeout = {10, 0};
+ ssh_channel channels[2];
+ channels[0] = channel;
+ channels[1] = NULL;
+ rc = ssh_channel_select(channels, NULL, NULL, &timeout);
+ if (rc == SSH_OK){
+ char buffer[256];
+ ssh_channel_read(channel, buffer, sizeof(buffer), 0);
+ }
+
+ REMMINA_DEBUG("Ran startup command");
+ ssh_channel_close(channel);
+ ssh_channel_free(channel);
+ }
+
+
return g_strdup_printf("127.0.0.1:%i", remmina_pref.sshtunnel_port);
#else