[PATCH] nm-applet - fix parse errors of dns and dns-searches text entries



	* src/connection-editor/page-ip4.c
		- (ui_to_setting) don't stop processing ui_to_settings when
		when g_strsplit_set result list contains an empty string.


=== modified file 'ChangeLog'
--- a/ChangeLog	2008-10-07 00:05:55 +0000
+++ b/ChangeLog	2008-10-08 17:08:57 +0000
@@ -1,8 +1,14 @@
+2008-10-08  Alexander Sack  <asac ubuntu com>
+
+	* src/connection-editor/page-ip4.c
+		- (ui_to_setting) don't stop processing ui_to_settings when
+		when g_strsplit_set result list contains an empty string.
+
 2008-10-06  Dan Williams  <dcbw redhat com>
 
 	* src/applet-device-cdma.c
 	  src/applet-device-gsm.c
 	  src/applet-device-wifi.c
 	  src/applet-device-wired.c
 		- (*_get_icon): use the active connection for more information in the
 			tooltip

=== modified file 'src/connection-editor/page-ip4.c'
--- a/src/connection-editor/page-ip4.c	2008-10-03 22:27:16 +0000
+++ b/src/connection-editor/page-ip4.c	2008-10-08 17:05:10 +0000
@@ -811,32 +811,37 @@ ui_to_setting (CEPageIP4 *self)
 	dns_servers = g_array_new (FALSE, FALSE, sizeof (guint));
 
 	text = gtk_entry_get_text (GTK_ENTRY (priv->dns_servers));
 	if (text && strlen (text)) {
 		items = g_strsplit_set (text, ", ;:", 0);
 		for (iter = items; *iter; iter++) {
 			struct in_addr tmp_addr;
 
+			if (!strlen (*iter))
+				continue;
+
 			if (inet_pton (AF_INET, g_strstrip (*iter), &tmp_addr))
 				g_array_append_val (dns_servers, tmp_addr.s_addr);
 			else {
 				g_strfreev (items);
 				goto out;
 			}
 		}
 		g_strfreev (items);
 	}
 
 	/* Search domains */
 	text = gtk_entry_get_text (GTK_ENTRY (priv->dns_searches));
 	if (text && strlen (text)) {
 		items = g_strsplit_set (text, ", ;:", 0);
-		for (iter = items; *iter; iter++)
-			search_domains = g_slist_prepend (search_domains, g_strdup (g_strstrip (*iter)));
+		for (iter = items; *iter; iter++) {
+			if (strlen (*iter))
+				search_domains = g_slist_prepend (search_domains, g_strdup (g_strstrip (*iter)));
+		}
 
 		if (items)
 			g_strfreev (items);
 	}
 
 	search_domains = g_slist_reverse (search_domains);
 
 	/* DHCP client ID */




 - Alexander



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