summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Anasal <[email protected]>2015-05-13 13:09:36 +0200
committerMonsta <[email protected]>2015-07-13 13:10:29 +0300
commit15043678502f49a89e1c52aec623f54443f22f0e (patch)
treec1f4c78b17b9162ff72e761e52ea50ff479065f4
parent94ad319b51bff9c5d05bcc8a9b4d9052ebe282da (diff)
downloadcaja-extensions-15043678502f49a89e1c52aec623f54443f22f0e.tar.bz2
caja-extensions-15043678502f49a89e1c52aec623f54443f22f0e.tar.xz
open-terminal: don't pass default ssh port when not explicitly given
omit the port on the commandline passed to the underlying ssh when none is explicitly given in vfs_uri and so leave it to ssh to determine the right port instead which may be a non-standard one configured in ssh_config
-rw-r--r--open-terminal/caja-open-terminal.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/open-terminal/caja-open-terminal.c b/open-terminal/caja-open-terminal.c
index f7b20eb..1c9e612 100644
--- a/open-terminal/caja-open-terminal.c
+++ b/open-terminal/caja-open-terminal.c
@@ -44,7 +44,6 @@
#include <stdlib.h> /* for atoi */
#include <sys/stat.h>
-#define SSH_DEFAULT_PORT 22
#define COT_SCHEMA "org.mate.caja-open-terminal"
#define COT_DESKTOP_KEY "desktop-opens-home-dir"
#define CAJA_SCHEMA "org.mate.caja.preferences"
@@ -226,6 +225,7 @@ append_sftp_info (char **terminal_exec,
GFile *vfs_uri;
char *host_name, *path, *user_name;
char *user_host, *cmd, *quoted_cmd;
+ char *host_port_switch;
guint host_port;
g_assert (terminal_exec != NULL);
@@ -241,7 +241,9 @@ append_sftp_info (char **terminal_exec,
parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
if (host_port == 0) {
- host_port = SSH_DEFAULT_PORT;
+ host_port_switch = g_strdup ("");
+ } else {
+ host_port_switch = g_strdup_printf ("-p %d", host_port);
}
if (user_name != NULL) {
@@ -250,7 +252,7 @@ append_sftp_info (char **terminal_exec,
user_host = g_strdup (host_name);
}
- cmd = g_strdup_printf ("ssh %s -p %d -t \"cd \'%s\' && $SHELL -l\"", user_host, host_port, path);
+ cmd = g_strdup_printf ("ssh %s %s -t \"cd \'%s\' && $SHELL -l\"", user_host, host_port_switch, path);
quoted_cmd = g_shell_quote (cmd);
g_free (cmd);
@@ -260,6 +262,7 @@ append_sftp_info (char **terminal_exec,
g_free (host_name);
g_free (user_name);
+ g_free (host_port_switch);
g_free (path);
g_free (quoted_cmd);