diff options
author | Ondrej Holy <oholy@redhat.com> | 2017-09-05 18:26:02 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2019-02-04 11:13:42 +0000 |
commit | 1a38caf8bcb4e02b68f8062319ef7736796a7e64 (patch) | |
tree | a0c8f19b1b3ba9f9a8f13d368ef5525360bea6e9 | |
parent | 54dd03f7f203de66f838a1128534ed65d6d68b5a (diff) | |
download | gvfs-1a38caf8bcb4e02b68f8062319ef7736796a7e64.tar.gz |
sftp: Always use port 22 if not specified
Currently, the default port - specified in mount file - is removed from
uri on client side, but it is not used by backend explicitely. It is not
a problem until the default port is changed in sshd_config and somebody
wants to connect to the server using the default port from mount file.
Let's use the port 22 explicitely, similarly as other backends do (i.e.
ftp, afc, afp).
Closes: https://gitlab.gnome.org/GNOME/gvfs/issues/129
-rw-r--r-- | daemon/gvfsbackendsftp.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c index a3a0d40e..3c3f5738 100644 --- a/daemon/gvfsbackendsftp.c +++ b/daemon/gvfsbackendsftp.c @@ -1128,7 +1128,7 @@ handle_login (GVfsBackend *backend, "sftp", object, authtype, - op_backend->port != -1 ? + op_backend->port != 22 ? op_backend->port : 0, @@ -1324,7 +1324,7 @@ handle_login (GVfsBackend *backend, "sftp", object, authtype, - op_backend->port != -1 ? + op_backend->port != 22 ? op_backend->port : 0, @@ -1989,7 +1989,7 @@ do_mount (GVfsBackend *backend, if (op_backend->user_specified_in_uri) g_mount_spec_set (sftp_mount_spec, "user", op_backend->user); g_mount_spec_set (sftp_mount_spec, "host", op_backend->host); - if (op_backend->port != -1) + if (op_backend->port != 22) { char *v; v = g_strdup_printf ("%d", op_backend->port); @@ -2059,12 +2059,10 @@ try_mount (GVfsBackend *backend, } port = g_mount_spec_get (mount_spec, "port"); - op_backend->port = -1; + op_backend->port = 22; if (port != NULL) { - int p = atoi (port); - if (p != 22) - op_backend->port = p; + op_backend->port = atoi (port); } user = g_mount_spec_get (mount_spec, "user"); |