[network-manager-openconnect] service: restore error for an invalid IPv6 address



commit 037cde3ba4ef366d141e8f552f1aa0d4f1a0c7fa
Author: Mike Miller <mtmiller ieee org>
Date:   Mon Jul 23 17:59:09 2012 -0400

    service: restore error for an invalid IPv6 address
    
    Check for and ignore a missing or empty INTERNAL_IP6_ADDRESS.  If a
    value is given and we are unable to parse a valid IPv6 address, then we
    should error out.

 src/nm-openconnect-service-openconnect-helper.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/nm-openconnect-service-openconnect-helper.c b/src/nm-openconnect-service-openconnect-helper.c
index e421232..fcaf953 100644
--- a/src/nm-openconnect-service-openconnect-helper.c
+++ b/src/nm-openconnect-service-openconnect-helper.c
@@ -585,14 +585,24 @@ main (int argc, char *argv[])
 	}
 
 	/* IPv6 address */
-	val = addr6_to_gvalue (getenv ("INTERNAL_IP6_ADDRESS"));
-	if (val)
-		g_hash_table_insert (ip6config, NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS, val);
+	tmp = getenv ("INTERNAL_IP6_ADDRESS");
+	if (tmp && strlen (tmp)) {
+		val = addr6_to_gvalue (tmp);
+		if (val)
+			g_hash_table_insert (ip6config, NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS, val);
+		else
+			helper_failed (connection, "IP6 Address");
+	}
 
 	/* IPv6 PTP address; for openconnect PTP address == internal IPv6 address */
-	val = addr6_to_gvalue (getenv ("INTERNAL_IP6_ADDRESS"));
-	if (val)
-		g_hash_table_insert (ip6config, NM_VPN_PLUGIN_IP6_CONFIG_PTP, val);
+	tmp = getenv ("INTERNAL_IP6_ADDRESS");
+	if (tmp && strlen (tmp)) {
+		val = addr6_to_gvalue (tmp);
+		if (val)
+			g_hash_table_insert (ip6config, NM_VPN_PLUGIN_IP6_CONFIG_PTP, val);
+		else
+			helper_failed (connection, "IP6 PTP Address");
+	}
 
 	/* IPv6 Netmask */
 	tmp = getenv ("INTERNAL_IP6_NETMASK");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]