mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-06 12:14:04 -05:00
Fix hostapd_cli get_config not to show key when WPA is disabled
Previously, incorrectly configured passphrase or group cipher type could be shown even if WPA was disabled.
This commit is contained in:
parent
2f7d9f2dd9
commit
088a225586
@ -519,7 +519,7 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
|
|||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
|
|
||||||
if (hapd->conf->wps_state &&
|
if (hapd->conf->wps_state && hapd->conf->wpa &&
|
||||||
hapd->conf->ssid.wpa_passphrase) {
|
hapd->conf->ssid.wpa_passphrase) {
|
||||||
ret = os_snprintf(pos, end - pos, "passphrase=%s\n",
|
ret = os_snprintf(pos, end - pos, "passphrase=%s\n",
|
||||||
hapd->conf->ssid.wpa_passphrase);
|
hapd->conf->ssid.wpa_passphrase);
|
||||||
@ -528,7 +528,8 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
|
|||||||
pos += ret;
|
pos += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hapd->conf->wps_state && hapd->conf->ssid.wpa_psk &&
|
if (hapd->conf->wps_state && hapd->conf->wpa &&
|
||||||
|
hapd->conf->ssid.wpa_psk &&
|
||||||
hapd->conf->ssid.wpa_psk->group) {
|
hapd->conf->ssid.wpa_psk->group) {
|
||||||
char hex[PMK_LEN * 2 + 1];
|
char hex[PMK_LEN * 2 + 1];
|
||||||
wpa_snprintf_hex(hex, sizeof(hex),
|
wpa_snprintf_hex(hex, sizeof(hex),
|
||||||
@ -593,12 +594,13 @@ static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
|
|||||||
pos += ret;
|
pos += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hapd->conf->wpa_group == WPA_CIPHER_CCMP) {
|
if (hapd->conf->wpa && hapd->conf->wpa_group == WPA_CIPHER_CCMP) {
|
||||||
ret = os_snprintf(pos, end - pos, "group_cipher=CCMP\n");
|
ret = os_snprintf(pos, end - pos, "group_cipher=CCMP\n");
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
pos += ret;
|
pos += ret;
|
||||||
} else if (hapd->conf->wpa_group == WPA_CIPHER_TKIP) {
|
} else if (hapd->conf->wpa &&
|
||||||
|
hapd->conf->wpa_group == WPA_CIPHER_TKIP) {
|
||||||
ret = os_snprintf(pos, end - pos, "group_cipher=TKIP\n");
|
ret = os_snprintf(pos, end - pos, "group_cipher=TKIP\n");
|
||||||
if (ret < 0 || ret >= end - pos)
|
if (ret < 0 || ret >= end - pos)
|
||||||
return pos - buf;
|
return pos - buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user