summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-03-05 14:26:48 +0000
committerAlexander Larsson <alexl@src.gnome.org>2009-03-05 14:26:48 +0000
commit090fa3125af62356c27bb4873b87a4d72ccfae63 (patch)
treea2b3c4cc7e3ba984da139e793dfb26c35868b6d2 /client
parent33824d8b0733ee95e0d5af5c2f65919d3cd5da67 (diff)
downloadgvfs-090fa3125af62356c27bb4873b87a4d72ccfae63.tar.gz
Bug 569199 – incorrectly open smb workgroup using a space
2009-03-05 Alexander Larsson <alexl@redhat.com> Bug 569199 – incorrectly open smb workgroup using a space * client/gvfsuriutils.c (g_vfs_encode_uri), (g_vfs_decode_uri): Escape and unescape host part too. This means we handle e.g. smb workgroups with spaces in them. Allowing escapes in hostnames complies with RFC 3986. * client/gdaemonvfs.c (get_mountspec_from_uri): Fix indentation svn path=/trunk/; revision=2288
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonvfs.c2
-rw-r--r--client/gvfsuriutils.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 94f7e9ba..c9f2cc97 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -234,7 +234,7 @@ get_mountspec_from_uri (GDaemonVfs *vfs,
if (mountable && mountable->host_is_inet)
{
/* Convert hostname to lower case */
- str_tolower_inplace (decoded->host);
+ str_tolower_inplace (decoded->host);
/* Remove brackets aroung ipv6 addresses */
l = strlen (decoded->host);
diff --git a/client/gvfsuriutils.c b/client/gvfsuriutils.c
index c9bae69b..206d5a7e 100644
--- a/client/gvfsuriutils.c
+++ b/client/gvfsuriutils.c
@@ -225,7 +225,7 @@ g_vfs_decode_uri (const char *uri)
decoded->port = -1;
}
- decoded->host = g_strndup (host_start, host_end - host_start);
+ decoded->host = g_uri_unescape_segment (host_start, host_end, NULL);
hier_part_start = authority_end;
}
@@ -261,7 +261,10 @@ g_vfs_encode_uri (GDecodedUri *decoded, gboolean allow_utf8)
g_string_append_c (uri, '@');
}
- g_string_append (uri, decoded->host);
+ g_string_append_uri_escaped (uri, decoded->host,
+ /* Allowed unescaped in hostname / ip address */
+ G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":[]" ,
+ allow_utf8);
if (decoded->port != -1)
{