service: Check that the supplied nameserver is in numeric format
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 4 Jun 2012 10:45:03 +0000 (13:45 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 14 Jun 2012 12:06:04 +0000 (15:06 +0300)
Check that the supplied nameserver is in numeric format when set
with 'Nameservers.Configuration' service property.

src/service.c

index c225af5..94ef7b6 100644 (file)
@@ -3041,10 +3041,12 @@ static DBusMessage *set_property(DBusConnection *conn,
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
-                       if (str->len > 0)
-                               g_string_append_printf(str, " %s", val);
-                       else
-                               g_string_append(str, val);
+                       if (connman_inet_check_ipaddress(val) > 0) {
+                               if (str->len > 0)
+                                       g_string_append_printf(str, " %s", val);
+                               else
+                                       g_string_append(str, val);
+                       }
                }
 
                remove_nameservers(service, NULL, service->nameservers_config);
                }
 
                remove_nameservers(service, NULL, service->nameservers_config);