[PATCH] accept full urls in nm-auth-dialog

Jussi Kukkonen jku at linux.intel.com
Tue Feb 23 04:26:58 EST 2010


E.g. "<host>:<port>" will now work.
---
 nm-auth-dialog.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/nm-auth-dialog.c b/nm-auth-dialog.c
index f173212..ae0fc22 100644
--- a/nm-auth-dialog.c
+++ b/nm-auth-dialog.c
@@ -1193,8 +1193,15 @@ static void connect_host(auth_ui_data *ui_data)
 	for (i = 0; i < host_nr; i++)
 		host = host->next;
 
-	ui_data->vpninfo->hostname = g_strdup(host->hostaddress);
-	if (host->usergroup)
+	if (parse_url(host->hostaddress, NULL,
+		      &ui_data->vpninfo->hostname, &ui_data->vpninfo->port,
+		      &ui_data->vpninfo->urlpath, 443)) {
+		fprintf(stderr, "Failed to parse server URL '%s'\n",
+			host->hostaddress);
+		ui_data->vpninfo->hostname = g_strdup(host->hostaddress);
+	}
+
+	if (!ui_data->vpninfo->urlpath && host->usergroup)
 		ui_data->vpninfo->urlpath = g_strdup(host->usergroup);
 
 	remember_gconf_key(ui_data, g_strdup("lasthost"), g_strdup(host->hostname));
-- 
1.6.6.1


--------------010008010909010609040602--



More information about the openconnect-devel mailing list