]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Explicit str/bytes conversion for key_lifetime_in_memory
authorJouni Malinen <j@w1.fi>
Sat, 2 Feb 2019 16:50:13 +0000 (18:50 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 10:26:34 +0000 (12:26 +0200)
This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_eap.py
tests/hwsim/test_ap_psk.py
tests/hwsim/test_erp.py
tests/hwsim/test_sae.py

index 39fd812fcb06b7132e37890e531936ad2f7f4269..0c45058fae131af94bfd116c9b32ea4cddc3a232 100644 (file)
@@ -5083,6 +5083,7 @@ def test_wpa2_eap_ttls_pap_key_lifetime_in_memory(dev, apdev, params):
     # eloop before reading process memory.
     time.sleep(1)
     dev[0].ping()
+    password = password.encode()
     buf = read_process_memory(pid, password)
 
     dev[0].request("DISCONNECT")
index b6ed58d5637bbd42c63dac8c856a1b295182fbb7..c10d835bd46539438c489974789045414fe9e297 100644 (file)
@@ -2329,7 +2329,7 @@ def read_process_memory(pid, key=None):
     buf = bytes()
     logger.info("Reading process memory (pid=%d)" % pid)
     with open('/proc/%d/maps' % pid, 'r') as maps, \
-         open('/proc/%d/mem' % pid, 'r') as mem:
+         open('/proc/%d/mem' % pid, 'rb') as mem:
         for l in maps.readlines():
             m = re.match(r'([0-9a-f]+)-([0-9a-f]+) ([-r][-w][-x][-p])', l)
             if not m:
@@ -2360,7 +2360,7 @@ def verify_not_present(buf, key, fname, keyname):
         return
 
     prefix = 2048 if pos > 2048 else pos
-    with open(fname + keyname, 'w') as f:
+    with open(fname + keyname, 'wb') as f:
         f.write(buf[pos - prefix:pos + 2048])
     raise Exception(keyname + " found after disassociation")
 
index 10b4234ea327eff8f1399f59af8ab3a5d8b7118a..7da605287ee2ca10a274d541543609ec3ce1729e 100644 (file)
@@ -1,5 +1,5 @@
 # EAP Re-authentication Protocol (ERP) tests
-# Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi>
+# Copyright (c) 2014-2019, Jouni Malinen <j@w1.fi>
 #
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
@@ -275,6 +275,7 @@ def test_erp_key_lifetime_in_memory(dev, apdev, params):
     # eloop before reading process memory.
     time.sleep(1)
     dev[0].ping()
+    password = password.encode()
     buf = read_process_memory(pid, password)
 
     dev[0].request("DISCONNECT")
index 104fb5bb4b20d00451f8da29491d8122106158a5..0e94d95ff104c3ca7e5c8c50ec2f3302eb451751 100644 (file)
@@ -362,6 +362,7 @@ def test_sae_key_lifetime_in_memory(dev, apdev, params):
     # eloop before reading process memory.
     time.sleep(1)
     dev[0].ping()
+    password = password.encode()
     buf = read_process_memory(pid, password)
 
     dev[0].request("DISCONNECT")