summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-06-30 14:29:46 +0200
committerOndrej Holy <oholy@redhat.com>2020-06-30 14:44:09 +0200
commit5266595595bf7cb3cf895ee04454b79aaada7c5c (patch)
tree83eba8cce95d3459fc06b3ff32115034b1ef39d8 /common
parent81babf58e59ff974369b3160a7e7e3a84ded110e (diff)
downloadgvfs-5266595595bf7cb3cf895ee04454b79aaada7c5c.tar.gz
client: Add support for zone identifiers in IPv6 addresses
The IPv6 addresses with zone identifiers are refused by GVfs currently. THis is because of g_uri_unescape_segment failure as RFC 4007 allows bare % sign to be used as separator. Although, RFC 6874 tries to fix that by the %25 separator, however, at the same time, it suggests that the bare % sign should still be accepted in user interfaces. But this would make this too complex and lead to various problems (e.g. it would not be clear what separator should be used for g_file_get_uri function). So I intentionally don't plan to support what is suggested by RFC 6874 for now, which effectively means that zone identifiers with non-ASCII chars won't be supported. Let's skip the g_uri_unescape_segment function for IPv6 address and also fix the gvfs_is_ipv6 function in order to accept the zone identifiers... Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/483
Diffstat (limited to 'common')
-rw-r--r--common/gvfsutils.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/common/gvfsutils.c b/common/gvfsutils.c
index cb994e4f..8e175d8c 100644
--- a/common/gvfsutils.c
+++ b/common/gvfsutils.c
@@ -129,18 +129,9 @@ gvfs_setup_debug_handler (void)
gboolean
gvfs_is_ipv6 (const char *host)
{
- const char *p = host;
-
g_return_val_if_fail (host != NULL, FALSE);
- if (*p != '[')
- return FALSE;
-
- while (++p)
- if (!g_ascii_isxdigit (*p) && *p != ':')
- break;
-
- if (*p != ']' || *(p + 1) != '\0')
+ if (*host != '[' || host[strlen (host) - 1] != ']')
return FALSE;
return TRUE;