D-Bus: Fix P2P Group PSK property getter

This was returning a byte array of the pointer to the PSK, not the
actual PSK, due to incorrect use of
wpas_dbus_simple_array_property_getter(). In addition, there is no need
to limit this property based on the role of the device in the group, so
return the PSK if it is available (which it will be for both GO and P2P
Client roles).

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-01-02 12:20:44 +02:00
parent a0caebf397
commit 20e1d81e09
1 changed files with 8 additions and 8 deletions

View File

@ -2066,20 +2066,20 @@ dbus_bool_t wpas_dbus_getter_p2p_group_psk(DBusMessageIter *iter,
DBusError *error, void *user_data)
{
struct wpa_supplicant *wpa_s = user_data;
u8 role = wpas_get_p2p_role(wpa_s);
u8 *p_psk = NULL;
u8 psk_len = 0;
struct wpa_ssid *ssid = wpa_s->current_ssid;
/* Verify correct role for this property */
if (role == WPAS_P2P_ROLE_CLIENT) {
if (wpa_s->current_ssid == NULL)
return FALSE;
p_psk = wpa_s->current_ssid->psk;
psk_len = 32;
if (ssid == NULL)
return FALSE;
if (ssid->psk_set) {
p_psk = ssid->psk;
psk_len = sizeof(ssid->psk);
}
return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
&p_psk, psk_len, error);
p_psk, psk_len, error);
}