From 838a5aa95a6e81fe92939edc3c5c047f5b977359 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 28 Mar 2021 18:35:46 +0300 Subject: [PATCH] tests: WPS Registrar init errors Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_wps.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 8818f159e..a07ed60b8 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -44,10 +44,12 @@ from wpasupplicant import WpaSupplicant from utils import * from test_ap_eap import int_eap_server_params -def wps_start_ap(apdev, ssid="test-wps-conf"): +def wps_start_ap(apdev, ssid="test-wps-conf", extra_cred=None): params = {"ssid": ssid, "eap_server": "1", "wps_state": "2", "wpa_passphrase": "12345678", "wpa": "2", "wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"} + if extra_cred: + params['extra_cred'] = extra_cred return hostapd.add_ap(apdev, params) @remote_compatible @@ -10552,3 +10554,15 @@ def start_wps_er(dev): ev = dev.wait_event(["WPS-ER-AP-ADD"], timeout=15) if ev is None: raise Exception("AP discovery timed out") + +def test_ap_wps_registrar_init_errors(dev, apdev): + """WPS Registrar init errors""" + hapd = wps_start_ap(apdev[0], extra_cred="wps-mixed-cred") + hapd.disable() + tests = [(1, "wps_registrar_init"), + (1, "wpabuf_alloc_copy;wps_registrar_init"), + (1, "wps_set_ie;wps_registrar_init")] + for count, func in tests: + with alloc_fail(hapd, count, func): + if "FAIL" not in hapd.request("ENABLE"): + raise Exception("ENABLE succeeded unexpectedly")