From 090fa3125af62356c27bb4873b87a4d72ccfae63 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 5 Mar 2009 14:26:48 +0000 Subject: =?UTF-8?q?Bug=20569199=20=E2=80=93=20incorrectly=20open=20smb=20w?= =?UTF-8?q?orkgroup=20using=20a=20space?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2009-03-05 Alexander Larsson 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 --- ChangeLog | 13 +++++++++++++ client/gdaemonvfs.c | 2 +- client/gvfsuriutils.c | 7 +++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f66faf6c..75af30fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-03-05 Alexander Larsson + + 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 + 2009-03-05 Alexander Larsson Bug 573381 – Memory leak in ftp_connection_parse_features() 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) { -- cgit v1.2.1