mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
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
@ -137,16 +137,17 @@ static int hostapd_wps_new_psk_cb(void *ctx, const u8 *mac_addr,
|
|||||||
if (ssid->wpa_psk_file) {
|
if (ssid->wpa_psk_file) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char hex[PMK_LEN * 2 + 1];
|
char hex[PMK_LEN * 2 + 1];
|
||||||
|
|
||||||
/* Add the new PSK to PSK list file */
|
/* Add the new PSK to PSK list file */
|
||||||
f = fopen(ssid->wpa_psk_file, "a");
|
f = fopen(ssid->wpa_psk_file, "a");
|
||||||
if (f == NULL) {
|
if (!f) {
|
||||||
wpa_printf(MSG_DEBUG, "Failed to add the PSK to "
|
wpa_printf(MSG_DEBUG, "Failed to add the PSK to '%s'",
|
||||||
"'%s'", ssid->wpa_psk_file);
|
ssid->wpa_psk_file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wpa_snprintf_hex(hex, sizeof(hex), psk, psk_len);
|
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);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user