From ee9533eb0e7e2ba0d5d58f57a2d33d3b2111fd9a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 17 Jan 2015 12:02:11 +0200 Subject: [PATCH] tests: EAP-MD5 server error cases Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_eap.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py index 311c1c9b3..accc134ff 100644 --- a/tests/hwsim/test_ap_eap.py +++ b/tests/hwsim/test_ap_eap.py @@ -15,7 +15,7 @@ import os import hwsim_utils import hostapd -from utils import HwsimSkip +from utils import HwsimSkip, alloc_fail from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verify_not_present, get_key_locations def check_hlr_auc_gw_support(): @@ -985,6 +985,39 @@ def test_ap_wpa2_eap_ttls_eap_md5(dev, apdev): hwsim_utils.test_connectivity(dev[0], hapd) eap_reauth(dev[0], "TTLS") +def test_ap_wpa2_eap_ttls_eap_md5_incorrect_password(dev, apdev): + """WPA2-Enterprise connection using EAP-TTLS/EAP-MD5 - incorrect password""" + params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap") + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + eap_connect(dev[0], apdev[0], "TTLS", "user", + anonymous_identity="ttls", password="wrong", + ca_cert="auth_serv/ca.pem", phase2="autheap=MD5", + expect_failure=True) + +def test_ap_wpa2_eap_ttls_eap_md5_server_oom(dev, apdev): + """WPA2-Enterprise connection using EAP-TTLS/EAP-MD5 - server OOM""" + params = int_eap_server_params() + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + with alloc_fail(hapd, 1, "eap_md5_init"): + eap_connect(dev[0], apdev[0], "TTLS", "user", + anonymous_identity="ttls", password="password", + ca_cert="auth_serv/ca.pem", phase2="autheap=MD5", + expect_failure=True) + dev[0].request("REMOVE_NETWORK all") + + with alloc_fail(hapd, 1, "eap_md5_buildReq"): + dev[0].connect("test-wpa2-eap", key_mgmt="WPA-EAP WPA-EAP-SHA256", + eap="TTLS", identity="user", + anonymous_identity="ttls", password="password", + ca_cert="auth_serv/ca.pem", phase2="autheap=MD5", + wait_connect=False, scan_freq="2412") + # This would eventually time out, but we can stop after having reached + # the allocation failure. + for i in range(20): + time.sleep(0.1) + if hapd.request("GET_ALLOC_FAIL").startswith('0'): + break + def test_ap_wpa2_eap_ttls_eap_mschapv2(dev, apdev): """WPA2-Enterprise connection using EAP-TTLS/EAP-MSCHAPv2""" params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")