From c2f1fe41c2498e4b62892f26c67d5a9c102ed83c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 8 Apr 2011 19:13:58 +0300 Subject: [PATCH] Fix WPA/WPA2 AP rejection on parameter mismatch If WPA/WPA2 was enabled in the configuration, the non-WPA exception could allow an incorrect AP to be selected from scan results. Do not use the exception if WPA/WPA2 is enabled in configuration. --- wpa_supplicant/events.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 41c5534e8..f94fc64b1 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -435,8 +435,15 @@ static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s, return 0; } - /* Allow in non-WPA configuration */ - return 1; + if (!wpa_key_mgmt_wpa(ssid->key_mgmt)) { + wpa_dbg(wpa_s, MSG_DEBUG, " allow in non-WPA/WPA2"); + return 1; + } + + wpa_dbg(wpa_s, MSG_DEBUG, " reject due to mismatch with " + "WPA/WPA2"); + + return 0; }