[network-manager-openconnect] core: pass multiple domains back to NM if given by vpnc (cherry picked from n-m-vpnc commit 237e6258



commit 0ed6b66d8461922e35bf91d054858df35d185dae
Author: Evan Broder <evan ebroder net>
Date:   Thu Mar 15 14:57:12 2012 -0700

    core: pass multiple domains back to NM if given by vpnc
    (cherry picked from n-m-vpnc commit 237e625883d251cb922d90c8cd7fa91fb9cc6c08)

 src/nm-openconnect-service-openconnect-helper.c |   25 +++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/nm-openconnect-service-openconnect-helper.c b/src/nm-openconnect-service-openconnect-helper.c
index 25e63c8..8ac651f 100644
--- a/src/nm-openconnect-service-openconnect-helper.c
+++ b/src/nm-openconnect-service-openconnect-helper.c
@@ -291,6 +291,26 @@ addr6_list_to_gvalue (const char *str)
 #define BUFLEN 256
 
 static GValue *
+split_dns_list_to_gvalue (const char *str)
+{
+	GValue *val;
+	char **split;
+
+	if (!str || strlen (str) < 1)
+		return NULL;
+
+	split = g_strsplit (str, ",", -1);
+	if (g_strv_length (split) == 0)
+		return NULL;
+
+	val = g_slice_new0 (GValue);
+	g_value_init (val, G_TYPE_STRV);
+	g_value_take_boxed (val, split);
+
+	return val;
+}
+
+static GValue *
 get_ip4_routes (void)
 {
 	GValue *value = NULL;
@@ -550,6 +570,11 @@ main (int argc, char *argv[])
 	if (val)
 		g_hash_table_insert (ip4config, NM_VPN_PLUGIN_IP4_CONFIG_NBNS, val);
 
+	/* Split DNS domains */
+	val = split_dns_list_to_gvalue (getenv ("CISCO_SPLIT_DNS"));
+	if (val)
+		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS, val);
+
 	/* Routes */
 	val = get_ip4_routes ();
 	if (val) {



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