Commit 534f966d authored by llyzs's avatar llyzs Committed by llyzs

Support the ipv6 notation format

git-svn-id: https://remmina.svn.sourceforge.net/svnroot/remmina/trunk@191 b6cfa94a-2857-405c-b0d6-536ef9fc39e1
parent fa60bfce
......@@ -76,7 +76,7 @@ remmina_avahi_resolve_callback (
g_free (key);
break;
}
value = g_strdup_printf ("%s/%i", host_name, port);
value = g_strdup_printf ("[%s]:%i", host_name, port);
g_hash_table_insert (ga->discovered_services, key, value);
/* key and value will be freed with g_free when the has table is freed */
......
......@@ -121,7 +121,7 @@ remmina_tp_channel_handler_connect (RemminaTpChannelHandler *chandler)
remminafile = g_new0 (RemminaFile, 1);
remminafile->name = chandler->alias;
remminafile->protocol = chandler->protocol;
remminafile->server = g_strdup_printf ("%s/%i", chandler->host, chandler->port);
remminafile->server = g_strdup_printf ("[%s]:%i", chandler->host, chandler->port);
remminafile->colordepth = 8;
chandler->alias = NULL;
......
......@@ -76,7 +76,7 @@ remmina_avahi_resolve_callback (
g_free (key);
break;
}
value = g_strdup_printf ("%s/%i", host_name, port);
value = g_strdup_printf ("[%s]:%i", host_name, port);
g_hash_table_insert (ga->discovered_services, key, value);
/* key and value will be freed with g_free when the has table is freed */
......
......@@ -74,7 +74,7 @@ static const gpointer sound_list[] =
NULL
};
static const gchar *server_tips = N_("Accepted formats: server, server:port or server/port");
static const gchar *server_tips = N_("Accepted formats: server, server:port or [server]:port");
struct _RemminaFileEditorPriv
{
......@@ -157,7 +157,7 @@ remmina_file_editor_browse_avahi (GtkWidget *button, RemminaFileEditor *gfe)
gfe->priv->plugin->avahi_service_type, NULL);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
host = g_strdup_printf ("%s/%i",
host = g_strdup_printf ("[%s]:%i",
aui_service_dialog_get_host_name (AUI_SERVICE_DIALOG (dialog)),
aui_service_dialog_get_port (AUI_SERVICE_DIALOG (dialog)));
}
......
......@@ -399,7 +399,7 @@ remmina_protocol_widget_start_direct_tunnel (RemminaProtocolWidget *gp, gint def
/* Protocols like VNC supports using instance number :0, :1, etc as port number. */
port += default_port;
}
dest = g_strdup_printf ("%s/%i", host, port);
dest = g_strdup_printf ("[%s]:%i", host, port);
g_free (host);
#ifdef HAVE_LIBSSH
......@@ -425,7 +425,7 @@ remmina_protocol_widget_start_direct_tunnel (RemminaProtocolWidget *gp, gint def
ptr = strchr (dest, ':');
if (ptr)
{
ptr = g_strdup_printf ("127.0.0.1/%s", ptr + 1);
ptr = g_strdup_printf ("127.0.0.1:%s", ptr + 1);
g_free (dest);
dest = ptr;
}
......@@ -439,7 +439,7 @@ remmina_protocol_widget_start_direct_tunnel (RemminaProtocolWidget *gp, gint def
}
g_free (dest);
return g_strdup_printf ("127.0.0.1/%i", remmina_pref.sshtunnel_port);
return g_strdup_printf ("127.0.0.1:%i", remmina_pref.sshtunnel_port);
#else
......
......@@ -290,34 +290,34 @@ remmina_public_get_server_port (const gchar *server, gint defaultport, gchar **h
str = g_strdup (server);
do
/* [server]:port format */
ptr = strchr (str, '[');
if (ptr)
{
/* server/port format */
ptr = strchr (str, '/');
if (ptr)
{
*ptr++ = '\0';
if (port) *port = atoi (ptr);
break;
}
ptr++;
ptr2 = strchr (ptr, ']');
if (ptr2) *ptr2++ = '\0';
if (*ptr2 == ':') defaultport = atoi (ptr2 + 1);
if (host) *host = strdup (ptr);
if (port) *port = defaultport;
free (str);
return;
}
/* server:port format, IPv6 cannot use this format */
ptr = strchr (str, ':');
if (ptr)
/* server:port format, IPv6 cannot use this format */
ptr = strchr (str, ':');
if (ptr)
{
ptr2 = strchr (ptr + 1, ':');
if (ptr2 == NULL)
{
ptr2 = strchr (ptr + 1, ':');
if (ptr2 == NULL)
{
*ptr++ = '\0';
if (port) *port = atoi (ptr);
break;
}
/* More than one ':' means this is IPv6 address. Treat it as a whole address */
*ptr++ = '\0';
defaultport = atoi (ptr);
}
if (port) *port = defaultport;
} while (0);
/* More than one ':' means this is IPv6 address. Treat it as a whole address */
}
if (host) *host = str;
if (port) *port = defaultport;
}
gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment