wpa_supplicant AP: Allows passphrase to be fetched
"wpa_cli status wps" can now be used to fetch the WPA2-Personal passphrase from AP mode operation with wpa_supplicant to make it easier to meet WPS requirements for legacy STA support. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
c0f83f3104
commit
0bc134683e
2 changed files with 18 additions and 3 deletions
|
@ -874,9 +874,10 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
|
|||
char *buf, size_t buflen)
|
||||
{
|
||||
char *pos, *end, tmp[30];
|
||||
int res, verbose, ret;
|
||||
int res, verbose, wps, ret;
|
||||
|
||||
verbose = os_strcmp(params, "-VERBOSE") == 0;
|
||||
wps = os_strcmp(params, "-WPS") == 0;
|
||||
pos = buf;
|
||||
end = buf + buflen;
|
||||
if (wpa_s->wpa_state >= WPA_ASSOCIATED) {
|
||||
|
@ -905,6 +906,17 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
|
|||
return pos - buf;
|
||||
pos += ret;
|
||||
|
||||
if (wps && ssid->passphrase &&
|
||||
wpa_key_mgmt_wpa_psk(ssid->key_mgmt) &&
|
||||
(ssid->mode == WPAS_MODE_AP ||
|
||||
ssid->mode == WPAS_MODE_P2P_GO)) {
|
||||
ret = os_snprintf(pos, end - pos,
|
||||
"passphrase=%s\n",
|
||||
ssid->passphrase);
|
||||
if (ret < 0 || ret >= end - pos)
|
||||
return pos - buf;
|
||||
pos += ret;
|
||||
}
|
||||
if (ssid->id_str) {
|
||||
ret = os_snprintf(pos, end - pos,
|
||||
"id_str=%s\n",
|
||||
|
|
|
@ -454,8 +454,11 @@ static int wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd)
|
|||
|
||||
static int wpa_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[])
|
||||
{
|
||||
int verbose = argc > 0 && os_strcmp(argv[0], "verbose") == 0;
|
||||
return wpa_ctrl_command(ctrl, verbose ? "STATUS-VERBOSE" : "STATUS");
|
||||
if (argc > 0 && os_strcmp(argv[0], "verbose") == 0)
|
||||
return wpa_ctrl_command(ctrl, "STATUS-VERBOSE");
|
||||
if (argc > 0 && os_strcmp(argv[0], "wps") == 0)
|
||||
return wpa_ctrl_command(ctrl, "STATUS-WPS");
|
||||
return wpa_ctrl_command(ctrl, "STATUS");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue