From 20e1d81e093e01e1e1405e2abbc5616213c70aba Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 2 Jan 2015 12:20:44 +0200 Subject: [PATCH] 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 --- wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index a526b91cf..339ebdfbe 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -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); }