[gvfs/wip/oholy/sftp-port: 5/5] sftp: Always use port 22 if not specified
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/sftp-port: 5/5] sftp: Always use port 22 if not specified
- Date: Mon, 4 Feb 2019 11:13:58 +0000 (UTC)
commit 1a38caf8bcb4e02b68f8062319ef7736796a7e64
Author: Ondrej Holy <oholy redhat com>
Date: Tue Sep 5 18:26:02 2017 +0200
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
daemon/gvfsbackendsftp.c | 12 +++++-------
1 file 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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]