service: Fix Domains property
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 21 May 2012 13:01:35 +0000 (16:01 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 22 May 2012 19:10:08 +0000 (21:10 +0200)
The service Domains property shows Domains.Configuration if set,
otherwise the domain name given by DHCP or provider.

Fixes BMC#25122

src/service.c

index e2f1f57..9220ad9 100644 (file)
@@ -1515,32 +1515,32 @@ static void append_tsconfig(DBusMessageIter *iter, void *user_data)
        }
 }
 
-static void append_domain(DBusMessageIter *iter, void *user_data)
+static void append_domainconfig(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
+       int i;
 
-       if (is_connected(service) == FALSE &&
-                               is_connecting(service) == FALSE)
-               return;
-
-       if (service->domainname == NULL)
+       if (service->domains == NULL)
                return;
 
-       dbus_message_iter_append_basic(iter,
-                               DBUS_TYPE_STRING, &service->domainname);
+       for (i = 0; service->domains[i]; i++)
+               dbus_message_iter_append_basic(iter,
+                               DBUS_TYPE_STRING, &service->domains[i]);
 }
 
-static void append_domainconfig(DBusMessageIter *iter, void *user_data)
+static void append_domain(DBusMessageIter *iter, void *user_data)
 {
        struct connman_service *service = user_data;
-       int i;
 
-       if (service->domains == NULL)
+       if (is_connected(service) == FALSE &&
+                               is_connecting(service) == FALSE)
                return;
 
-       for (i = 0; service->domains[i]; i++)
+       if (service->domains != NULL)
+               append_domainconfig(iter, user_data);
+       else if (service->domainname != NULL)
                dbus_message_iter_append_basic(iter,
-                               DBUS_TYPE_STRING, &service->domains[i]);
+                               DBUS_TYPE_STRING, &service->domainname);
 }
 
 static void append_proxies(DBusMessageIter *iter, void *user_data)