WPS: Add new PSK entries with wps=1 tag
Now that hostapd wpa_psk_file has a new tag for identifying PSKs that can be used with WPS, add that tag to new entries for PSKs from WPS. This makes it clearer where the PSK came from and in addition, this allows the same PSK to be assigned if the same Enrollee goes through WPS provisioning again. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
68e9b8cb16
commit
2bab073dfe
1 changed files with 5 additions and 4 deletions
|
@ -137,16 +137,17 @@ static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr,
|
|||
if (ssid->wpa_psk_file) {
|
||||
FILE *f;
|
||||
char hex[PMK_LEN * 2 + 1];
|
||||
|
||||
/* Add the new PSK to PSK list file */
|
||||
f = fopen(ssid->wpa_psk_file, "a");
|
||||
if (f == NULL) {
|
||||
wpa_printf(MSG_DEBUG, "Failed to add the PSK to "
|
||||
"'%s'", ssid->wpa_psk_file);
|
||||
if (!f) {
|
||||
wpa_printf(MSG_DEBUG, "Failed to add the PSK to '%s'",
|
||||
ssid->wpa_psk_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
wpa_snprintf_hex(hex, sizeof(hex), psk, psk_len);
|
||||
fprintf(f, MACSTR " %s\n", MAC2STR(mac_addr), hex);
|
||||
fprintf(f, "wps=1 " MACSTR " %s\n", MAC2STR(mac_addr), hex);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue