gvfs r1371 - in trunk: . client daemon
- From: alexl svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1371 - in trunk: . client daemon
- Date: Mon, 25 Feb 2008 15:44:43 +0000 (GMT)
Author: alexl
Date: Mon Feb 25 15:44:43 2008
New Revision: 1371
URL: http://svn.gnome.org/viewvc/gvfs?rev=1371&view=rev
Log:
2008-02-25 Alexander Larsson <alexl redhat com>
* client/sftpuri.c:
Make sure both no-port and port 22 refer to the same mount.
* daemon/gvfsbackendsftp.c:
Support ports. (#518504)
Modified:
trunk/ChangeLog
trunk/client/sftpuri.c
trunk/daemon/gvfsbackendsftp.c
Modified: trunk/client/sftpuri.c
==============================================================================
--- trunk/client/sftpuri.c (original)
+++ trunk/client/sftpuri.c Mon Feb 25 15:44:43 2008
@@ -81,7 +81,7 @@
if (uri->userinfo && *uri->userinfo)
g_vfs_uri_mount_info_set (info, "user", uri->userinfo);
- if (uri->port != -1)
+ if (uri->port != -1 && uri->port != 22)
{
char *port = g_strdup_printf ("%d", uri->port);
g_vfs_uri_mount_info_set (info, "port", port);
@@ -122,7 +122,14 @@
port = g_vfs_uri_mount_info_get (info, "port");
if (port != NULL)
- uri.port = atoi (port);
+ {
+ uri.port = atoi (port);
+ /* Kinda lame, but we want to alias port 22 and not-specified port
+ * so they are the same mount
+ */
+ if (uri.port == 22)
+ uri.port = -1;
+ }
if (info->path == NULL)
uri.path = "/";
Modified: trunk/daemon/gvfsbackendsftp.c
==============================================================================
--- trunk/daemon/gvfsbackendsftp.c (original)
+++ trunk/daemon/gvfsbackendsftp.c Mon Feb 25 15:44:43 2008
@@ -107,6 +107,7 @@
SFTPClientVendor client_vendor;
char *host;
+ int port;
gboolean user_specified;
char *user;
char *tmp_password;
@@ -320,13 +321,11 @@
else if (op_backend->client_vendor == SFTP_VENDOR_SSH)
args[last_arg++] = g_strdup ("-x");
- /* TODO: Support port
- if (port != 0)
+ if (op_backend->port != -1)
{
args[last_arg++] = g_strdup ("-p");
- args[last_arg++] = g_strdup_printf ("%d", port);
+ args[last_arg++] = g_strdup_printf ("%d", op_backend->port);
}
- */
args[last_arg++] = g_strdup ("-l");
@@ -1312,6 +1311,13 @@
if (op_backend->user_specified)
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)
+ {
+ char *v;
+ v = g_strdup_printf ("%d", op_backend->port);
+ g_mount_spec_set (sftp_mount_spec, "port", v);
+ g_free (v);
+ }
g_vfs_backend_set_mount_spec (backend, sftp_mount_spec);
g_mount_spec_unref (sftp_mount_spec);
@@ -1333,7 +1339,7 @@
gboolean is_automount)
{
GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
- const char *user, *host;
+ const char *user, *host, *port;
op_backend->client_vendor = get_sftp_client_vendor ();
@@ -1355,6 +1361,15 @@
return TRUE;
}
+ port = g_mount_spec_get (mount_spec, "port");
+ op_backend->port = -1;
+ if (port != NULL)
+ {
+ int p = atoi (port);
+ if (p != 22)
+ op_backend->port = p;
+ }
+
user = g_mount_spec_get (mount_spec, "user");
op_backend->host = g_strdup (host);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]