[PATCH 2/2] tests: External password (file) storage with partially matching keys
Joshua Manchester
joshuamanchester4 at gmail.com
Tue Jan 21 11:38:48 PST 2025
Signed-off-by: Joshua Manchester <joshuamanchester4 at gmail.com>
---
tests/hwsim/test_ext_password.py | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tests/hwsim/test_ext_password.py b/tests/hwsim/test_ext_password.py
index c8a880f08..f7cc75650 100644
--- a/tests/hwsim/test_ext_password.py
+++ b/tests/hwsim/test_ext_password.py
@@ -123,6 +123,31 @@ def test_ext_password_file_psk_with_hash(dev, apdev):
dev[0].request("SET ext_password_backend file:%s" % fn)
dev[0].connect("ext-pw-psk", raw_psk="ext:psk1", scan_freq="2412")
+def test_ext_password_file_with_partially_matching_keys(dev, apdev):
+ """External password (file) storage with partially matching keys"""
+ params = hostapd.wpa2_params(ssid="ext-pw-psk", passphrase="12345678")
+ hostapd.add_ap(apdev[0], params)
+ fd, fn = tempfile.mkstemp()
+ with open(fn, "w") as f:
+ f.write("psk=password\n")
+ f.write("psk1=12345678\n")
+ os.close(fd)
+ dev[0].request("SET ext_password_backend file:%s" % fn)
+ dev[0].connect("ext-pw-psk", raw_psk="ext:psk1", scan_freq="2412")
+ for i in range(2):
+ dev[0].request("REMOVE_NETWORK all")
+ if i == 0:
+ dev[0].wait_disconnected()
+ dev[0].connect("ext-pw-psk", raw_psk="ext:psk12", scan_freq="2412",
+ wait_connect=False)
+ else:
+ dev[0].connect("ext-pw-psk", raw_psk="ext:ps", scan_freq="2412",
+ wait_connect=False)
+ ev = dev[0].wait_event(["EXT PW: No PSK found from external storage"],
+ timeout=10)
+ if ev is None:
+ raise Exception("No connection result reported")
+
@remote_compatible
def test_ext_password_sae(dev, apdev):
"""External password storage for SAE"""
--
2.47.0
More information about the Hostap
mailing list