D-Bus: Make P2P Group Passphrase property getter available for P2P Client

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>
This commit is contained in:
Jouni Malinen 2015-01-02 12:25:32 +02:00
parent 20e1d81e09
commit 1a4efde5bd

View file

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