summaryrefslogtreecommitdiff
path: root/open-terminal/caja-open-terminal.c
diff options
context:
space:
mode:
authorRoman Anasal <[email protected]>2015-05-13 13:09:36 +0200
committerinfirit <[email protected]>2015-06-30 19:41:22 +0200
commitf69545f3145e3cb41c3f3102be4277be96af2967 (patch)
tree2ea8e61076187bd229a20ca686ca2fefcfa53a5e /open-terminal/caja-open-terminal.c
parentf60b5cb313b654553f1837b92c6306e1d15dc6ed (diff)
downloadcaja-extensions-f69545f3145e3cb41c3f3102be4277be96af2967.tar.bz2
caja-extensions-f69545f3145e3cb41c3f3102be4277be96af2967.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
Diffstat (limited to 'open-terminal/caja-open-terminal.c')
-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 488daba..a40befc 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);