aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorHagai Moshe <hagai.moshe@tandemg.com>2018-07-12 15:35:51 (GMT)
committerJouni Malinen <j@w1.fi>2019-01-02 22:52:51 (GMT)
commitb9eb717f85fbca320b9782cfbce56ba7af28c5e2 (patch)
tree689b616974c5e749543a83d842fe21c28b0a97eb /wpa_supplicant
parent38b405c8f055fafd3117bee32c108de86f835f94 (diff)
downloadhostap-b9eb717f85fbca320b9782cfbce56ba7af28c5e2.zip
hostap-b9eb717f85fbca320b9782cfbce56ba7af28c5e2.tar.gz
hostap-b9eb717f85fbca320b9782cfbce56ba7af28c5e2.tar.bz2
wpa_cli: Add command for setting PSK_PASSPHRASE
Setting mem_only_psk=1 in the wpa_supplicant configuration prevents the passphrase from being stored in the configuration file. wpa_supplicant will request the PSK passphrase over the control interface in such case and this new wpa_cli command can be used to set the psk_passphrase. usage: psk_passphrase <network id> <psk_passphrase> Signed-off-by: Hagai Moshe <hagai.moshe@tandemg.com> Signed-off-by: Simon Dinkin <simon.dinkin@tandemg.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wpa_cli.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 2f425a8..9881021 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1205,6 +1205,39 @@ static int wpa_cli_cmd_sim(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
+static int wpa_cli_cmd_psk_passphrase(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char cmd[256], *pos, *end;
+ int i, ret;
+
+ if (argc < 2) {
+ printf("Invalid PSK_PASSPHRASE command: needs two arguments (network id and PSK/passphrase)\n");
+ return -1;
+ }
+
+ end = cmd + sizeof(cmd);
+ pos = cmd;
+ ret = os_snprintf(pos, end - pos, WPA_CTRL_RSP "PSK_PASSPHRASE-%s:%s",
+ argv[0], argv[1]);
+ if (os_snprintf_error(end - pos, ret)) {
+ printf("Too long PSK_PASSPHRASE command.\n");
+ return -1;
+ }
+ pos += ret;
+ for (i = 2; i < argc; i++) {
+ ret = os_snprintf(pos, end - pos, " %s", argv[i]);
+ if (os_snprintf_error(end - pos, ret)) {
+ printf("Too long PSK_PASSPHRASE command.\n");
+ return -1;
+ }
+ pos += ret;
+ }
+
+ return wpa_ctrl_command(ctrl, cmd);
+}
+
+
static int wpa_cli_cmd_passphrase(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -3095,6 +3128,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = {
cli_cmd_flag_sensitive,
"<network id> <password> = configure one-time-password for an SSID"
},
+ { "psk_passphrase", wpa_cli_cmd_psk_passphrase,
+ wpa_cli_complete_network_id, cli_cmd_flag_sensitive,
+ "<network id> <PSK/passphrase> = configure PSK/passphrase for an SSID" },
{ "passphrase", wpa_cli_cmd_passphrase, wpa_cli_complete_network_id,
cli_cmd_flag_sensitive,
"<network id> <passphrase> = configure private key passphrase\n"