From 3955d2af73245e1a36a81cff8af898b145a0accf Mon Sep 17 00:00:00 2001 From: Arowa Suliman Date: Sat, 18 Sep 2021 23:24:29 -0700 Subject: [PATCH] Replace "dummy" with "stub" in wps_testing_dummy_cred Replace the word "dummy" with the inclusive word "stub". Signed-off-by: Arowa Suliman --- hostapd/ctrl_iface.c | 10 +++++----- hostapd/hostapd_cli.c | 2 +- src/wps/wps.c | 2 +- src/wps/wps_defs.h | 2 +- src/wps/wps_registrar.c | 26 +++++++++++++------------- tests/hwsim/test_ap_wps.py | 8 ++++---- tests/hwsim/test_p2p_autogo.py | 2 +- wpa_supplicant/ctrl_iface.c | 10 +++++----- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 4a2d60627..280e94fec 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1455,10 +1455,10 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) wps_version_number & 0x0f); hostapd_wps_update_ie(hapd); } - } else if (os_strcasecmp(cmd, "wps_testing_dummy_cred") == 0) { - wps_testing_dummy_cred = atoi(value); - wpa_printf(MSG_DEBUG, "WPS: Testing - dummy_cred=%d", - wps_testing_dummy_cred); + } else if (os_strcasecmp(cmd, "wps_testing_stub_cred") == 0) { + wps_testing_stub_cred = atoi(value); + wpa_printf(MSG_DEBUG, "WPS: Testing - stub_cred=%d", + wps_testing_stub_cred); } else if (os_strcasecmp(cmd, "wps_corrupt_pkhash") == 0) { wps_corrupt_pkhash = atoi(value); wpa_printf(MSG_DEBUG, "WPS: Testing - wps_corrupt_pkhash=%d", @@ -4470,7 +4470,7 @@ static void hostapd_ctrl_iface_flush(struct hapd_interfaces *interfaces) { #ifdef CONFIG_WPS_TESTING wps_version_number = 0x20; - wps_testing_dummy_cred = 0; + wps_testing_stub_cred = 0; wps_corrupt_pkhash = 0; #endif /* CONFIG_WPS_TESTING */ diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index eaa628ad0..0e7fdd6bc 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1048,7 +1048,7 @@ static char ** hostapd_complete_set(const char *str, int pos) int arg = get_cmd_arg_num(str, pos); const char *fields[] = { #ifdef CONFIG_WPS_TESTING - "wps_version_number", "wps_testing_dummy_cred", + "wps_version_number", "wps_testing_stub_cred", "wps_corrupt_pkhash", #endif /* CONFIG_WPS_TESTING */ #ifdef CONFIG_INTERWORKING diff --git a/src/wps/wps.c b/src/wps/wps.c index 484df262c..1fe38063b 100644 --- a/src/wps/wps.c +++ b/src/wps/wps.c @@ -17,7 +17,7 @@ #ifdef CONFIG_WPS_TESTING int wps_version_number = 0x20; -int wps_testing_dummy_cred = 0; +int wps_testing_stub_cred = 0; int wps_corrupt_pkhash = 0; int wps_force_auth_types_in_use = 0; u16 wps_force_auth_types = 0; diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h index 9fccb4eeb..ddaeda56d 100644 --- a/src/wps/wps_defs.h +++ b/src/wps/wps_defs.h @@ -12,7 +12,7 @@ #ifdef CONFIG_WPS_TESTING extern int wps_version_number; -extern int wps_testing_dummy_cred; +extern int wps_testing_stub_cred; extern int wps_corrupt_pkhash; extern int wps_force_auth_types_in_use; extern u16 wps_force_auth_types; diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c index 173fbbd68..9587293d0 100644 --- a/src/wps/wps_registrar.c +++ b/src/wps/wps_registrar.c @@ -1785,23 +1785,23 @@ int wps_build_cred(struct wps_data *wps, struct wpabuf *msg) use_provided: #ifdef CONFIG_WPS_TESTING - if (wps_testing_dummy_cred) + if (wps_testing_stub_cred) cred = wpabuf_alloc(200); else cred = NULL; if (cred) { - struct wps_credential dummy; - wpa_printf(MSG_DEBUG, "WPS: Add dummy credential"); - os_memset(&dummy, 0, sizeof(dummy)); - os_memcpy(dummy.ssid, "dummy", 5); - dummy.ssid_len = 5; - dummy.auth_type = WPS_AUTH_WPA2PSK; - dummy.encr_type = WPS_ENCR_AES; - os_memcpy(dummy.key, "dummy psk", 9); - dummy.key_len = 9; - os_memcpy(dummy.mac_addr, wps->mac_addr_e, ETH_ALEN); - wps_build_credential(cred, &dummy); - wpa_hexdump_buf(MSG_DEBUG, "WPS: Dummy Credential", cred); + struct wps_credential stub; + wpa_printf(MSG_DEBUG, "WPS: Add stub credential"); + os_memset(&stub, 0, sizeof(stub)); + os_memcpy(stub.ssid, "stub", 5); + stub.ssid_len = 5; + stub.auth_type = WPS_AUTH_WPA2PSK; + stub.encr_type = WPS_ENCR_AES; + os_memcpy(stub.key, "stub psk", 9); + stub.key_len = 9; + os_memcpy(stub.mac_addr, wps->mac_addr_e, ETH_ALEN); + wps_build_credential(cred, &stub); + wpa_hexdump_buf(MSG_DEBUG, "WPS: Stub Credential", cred); wpabuf_put_be16(msg, ATTR_CRED); wpabuf_put_be16(msg, wpabuf_len(cred)); diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py index 4a5083bef..e5e2f0fd9 100644 --- a/tests/hwsim/test_ap_wps.py +++ b/tests/hwsim/test_ap_wps.py @@ -10131,8 +10131,8 @@ def test_ap_wps_tkip(dev, apdev): if "FAIL" not in hapd.request("WPS_PBC"): raise Exception("WPS unexpectedly enabled") -def test_ap_wps_conf_dummy_cred(dev, apdev): - """WPS PIN provisioning with configured AP using dummy cred""" +def test_ap_wps_conf_stub_cred(dev, apdev): + """WPS PIN provisioning with configured AP using stub cred""" ssid = "test-wps-conf" hapd = hostapd.add_ap(apdev[0], {"ssid": ssid, "eap_server": "1", "wps_state": "2", @@ -10142,7 +10142,7 @@ def test_ap_wps_conf_dummy_cred(dev, apdev): dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412") dev[0].dump_monitor() try: - hapd.set("wps_testing_dummy_cred", "1") + hapd.set("wps_testing_stub_cred", "1") dev[0].request("WPS_PIN " + apdev[0]['bssid'] + " 12345670") for i in range(1, 3): ev = dev[0].wait_event(["WPS-CRED-RECEIVED"], timeout=15) @@ -10150,7 +10150,7 @@ def test_ap_wps_conf_dummy_cred(dev, apdev): raise Exception("WPS credential %d not received" % i) dev[0].wait_connected(timeout=30) finally: - hapd.set("wps_testing_dummy_cred", "0") + hapd.set("wps_testing_stub_cred", "0") def test_ap_wps_rf_bands(dev, apdev): """WPS and wps_rf_bands configuration""" diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py index 91d68eaf2..d857c9025 100644 --- a/tests/hwsim/test_p2p_autogo.py +++ b/tests/hwsim/test_p2p_autogo.py @@ -378,7 +378,7 @@ def test_autogo_chan_switch_group_iface(dev): @remote_compatible def test_autogo_extra_cred(dev): """P2P autonomous GO sending two WPS credentials""" - if "FAIL" in dev[0].request("SET wps_testing_dummy_cred 1"): + if "FAIL" in dev[0].request("SET wps_testing_stub_cred 1"): raise Exception("Failed to enable test mode") autogo(dev[0], freq=2412) connect_cli(dev[0], dev[1], social=True, freq=2412) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index f9ce1d2d4..9875b22e7 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -568,10 +568,10 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s, (wps_version_number & 0xf0) >> 4, wps_version_number & 0x0f); } - } else if (os_strcasecmp(cmd, "wps_testing_dummy_cred") == 0) { - wps_testing_dummy_cred = atoi(value); - wpa_printf(MSG_DEBUG, "WPS: Testing - dummy_cred=%d", - wps_testing_dummy_cred); + } else if (os_strcasecmp(cmd, "wps_testing_stub_cred") == 0) { + wps_testing_stub_cred = atoi(value); + wpa_printf(MSG_DEBUG, "WPS: Testing - stub_cred=%d", + wps_testing_stub_cred); } else if (os_strcasecmp(cmd, "wps_corrupt_pkhash") == 0) { wps_corrupt_pkhash = atoi(value); wpa_printf(MSG_DEBUG, "WPS: Testing - wps_corrupt_pkhash=%d", @@ -8447,7 +8447,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) #ifdef CONFIG_WPS_TESTING wps_version_number = 0x20; - wps_testing_dummy_cred = 0; + wps_testing_stub_cred = 0; wps_corrupt_pkhash = 0; wps_force_auth_types_in_use = 0; wps_force_encr_types_in_use = 0;