aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-01-02 10:20:44 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-02 20:50:27 (GMT)
commit20e1d81e093e01e1e1405e2abbc5616213c70aba (patch)
treef2660b1ee0362b1e56ae154fab10e29f85a44ccf /wpa_supplicant/dbus/dbus_new_handlers_p2p.c
parenta0caebf3977a037a87e4636b2bb7be5ae1b3fe4d (diff)
downloadhostap-20e1d81e093e01e1e1405e2abbc5616213c70aba.zip
hostap-20e1d81e093e01e1e1405e2abbc5616213c70aba.tar.gz
hostap-20e1d81e093e01e1e1405e2abbc5616213c70aba.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant/dbus/dbus_new_handlers_p2p.c')
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers_p2p.c16
1 files 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 a526b91..339ebdf 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);
}