Skip to content

Commit 48916d6

Browse files
krish2718carlescufi
authored andcommitted
modules: hostap: Fix checks for Enterprise security
Enterprise security doesn't have either SAE or PSK, so, using a blanker else throws a false warning. Fix the checks to proper handler enterprise mode. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 6cac954 commit 48916d6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

modules/hostap/src/supp_api.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
511511
}
512512

513513
if (params->security != WIFI_SECURITY_TYPE_NONE) {
514-
if (params->sae_password) {
515-
if ((params->sae_password_length < WIFI_PSK_MIN_LEN) ||
516-
(params->sae_password_length > WIFI_SAE_PSWD_MAX_LEN)) {
517-
wpa_printf(MSG_ERROR,
518-
"Passphrase should be in range (%d-%d) characters",
519-
WIFI_PSK_MIN_LEN, WIFI_SAE_PSWD_MAX_LEN);
520-
goto out;
521-
}
522-
strncpy(sae_null_terminated, params->sae_password, WIFI_SAE_PSWD_MAX_LEN);
523-
sae_null_terminated[params->sae_password_length] = '\0';
524-
} else {
514+
if (params->psk) {
525515
if ((params->psk_length < WIFI_PSK_MIN_LEN) ||
526516
(params->psk_length > WIFI_PSK_MAX_LEN)) {
527517
wpa_printf(MSG_ERROR,
@@ -553,6 +543,16 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
553543
params->security == WIFI_SECURITY_TYPE_SAE_H2E ||
554544
params->security == WIFI_SECURITY_TYPE_SAE_AUTO) {
555545
if (params->sae_password) {
546+
if ((params->sae_password_length < WIFI_PSK_MIN_LEN) ||
547+
(params->sae_password_length > WIFI_SAE_PSWD_MAX_LEN)) {
548+
wpa_printf(MSG_ERROR,
549+
"Passphrase should be in range (%d-%d) characters",
550+
WIFI_PSK_MIN_LEN, WIFI_SAE_PSWD_MAX_LEN);
551+
goto out;
552+
}
553+
strncpy(sae_null_terminated, params->sae_password,
554+
WIFI_SAE_PSWD_MAX_LEN);
555+
sae_null_terminated[params->sae_password_length] = '\0';
556556
if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"",
557557
resp.network_id, sae_null_terminated)) {
558558
goto out;

0 commit comments

Comments
 (0)