]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix D-Bus property getters to default to "/" for Group, PeerGO
authorNirav Shah <nirav.j2.shah@intel.com>
Sat, 14 Apr 2012 17:48:26 +0000 (20:48 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 14 Apr 2012 17:48:26 +0000 (20:48 +0300)
The D-Bus property getters should not return an error when the
properties are not valid/relevant. Returning an error breaks the
GetAll method in the dbus interface. Change Group and PeerGO
property getters to make GetAll work on P2PDevice.

Signed-hostap: Nirav Shah <nirav.j2.shah@intel.com>
Signed-hostap: Angie Chinchilla <angie.v.chinchilla@intel.com>
intended-for: hostap-1

wpa_supplicant/dbus/dbus_new_handlers_p2p.c

index ad3cc113706a15d892e19e27cace9917efb25fd7..2b514e12ba427322a226fe9573d15ea2066de535 100644 (file)
@@ -1140,13 +1140,18 @@ dbus_bool_t wpas_dbus_getter_p2p_group(DBusMessageIter *iter, DBusError *error,
                                       void *user_data)
 {
        struct wpa_supplicant *wpa_s = user_data;
+       char path_buf[WPAS_DBUS_OBJECT_PATH_MAX];
+       char *dbus_groupobj_path = path_buf;
 
        if (wpa_s->dbus_groupobj_path == NULL)
-               return FALSE;
+               os_snprintf(dbus_groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX,
+                           "/");
+       else
+               os_snprintf(dbus_groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX,
+                           "%s", wpa_s->dbus_groupobj_path);
 
        return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
-                                               &wpa_s->dbus_groupobj_path,
-                                               error);
+                                               &dbus_groupobj_path, error);
 }
 
 
@@ -1157,11 +1162,13 @@ dbus_bool_t wpas_dbus_getter_p2p_peergo(DBusMessageIter *iter,
        char go_peer_obj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
 
        if (wpas_get_p2p_role(wpa_s) != WPAS_P2P_ROLE_CLIENT)
-               return FALSE;
+               os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
+       else
+               os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
+                           "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/"
+                           COMPACT_MACSTR,
+                           wpa_s->dbus_new_path, MAC2STR(wpa_s->go_dev_addr));
 
-       os_snprintf(go_peer_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
-                   "%s/" WPAS_DBUS_NEW_P2P_PEERS_PART "/" COMPACT_MACSTR,
-                   wpa_s->dbus_new_path, MAC2STR(wpa_s->go_dev_addr));
        path = go_peer_obj_path;
        return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
                                                &path, error);