From 1ec32698618f20620122581ee55c87598f74480d Mon Sep 17 00:00:00 2001 From: Mayank Sharma Date: Tue, 26 Mar 2019 07:00:30 +0530 Subject: Revert "sftp: Always use port 22 if not specified" This reverts commit 1a38caf8bcb4e02b68f8062319ef7736796a7e64 as it breaks "bookmarks" from `ssh_config`. https://gitlab.gnome.org/GNOME/gvfs/issues/382 --- daemon/gvfsbackendsftp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c index 2314579f..48603852 100644 --- a/daemon/gvfsbackendsftp.c +++ b/daemon/gvfsbackendsftp.c @@ -1134,7 +1134,7 @@ handle_login (GVfsBackend *backend, "sftp", object, authtype, - op_backend->port != 22 ? + op_backend->port != -1 ? op_backend->port : 0, @@ -1330,7 +1330,7 @@ handle_login (GVfsBackend *backend, "sftp", object, authtype, - op_backend->port != 22 ? + op_backend->port != -1 ? op_backend->port : 0, @@ -1995,7 +1995,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 != 22) + if (op_backend->port != -1) { char *v; v = g_strdup_printf ("%d", op_backend->port); @@ -2065,10 +2065,12 @@ try_mount (GVfsBackend *backend, } port = g_mount_spec_get (mount_spec, "port"); - op_backend->port = 22; + op_backend->port = -1; if (port != NULL) { - op_backend->port = atoi (port); + int p = atoi (port); + if (p != 22) + op_backend->port = p; } user = g_mount_spec_get (mount_spec, "user"); -- cgit v1.2.1