D-Bus: Make P2P Group Passphrase property getter available for P2P Client
authorJouni Malinen <j@w1.fi>
Fri, 2 Jan 2015 10:25:32 +0000 (12:25 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 2 Jan 2015 20:50:27 +0000 (22:50 +0200)
There is no need to limit this property based on the role of the device
in the group, so return the passphrase if it is available. It will be
available in GO role and it may be available in P2P Client role based on
whether the peer GO provided it during the WPS provisioning step.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/dbus/dbus_new_handlers_p2p.c

index 339ebdf..9c880a2 100644 (file)
@@ -2045,15 +2045,14 @@ dbus_bool_t wpas_dbus_getter_p2p_group_passphrase(DBusMessageIter *iter,
                                                  void *user_data)
 {
        struct wpa_supplicant *wpa_s = user_data;
-       u8 role = wpas_get_p2p_role(wpa_s);
-       char *p_pass = NULL;
+       char *p_pass;
+       struct wpa_ssid *ssid = wpa_s->current_ssid;
 
-       /* Verify correct role for this property */
-       if (role == WPAS_P2P_ROLE_GO) {
-               if (wpa_s->current_ssid == NULL)
-                       return FALSE;
-               p_pass = wpa_s->current_ssid->passphrase;
-       } else
+       if (ssid == NULL)
+               return FALSE;
+
+       p_pass = ssid->passphrase;
+       if (!p_pass)
                p_pass = "";
 
        return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,