aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-01-01 19:29:25 (GMT)
committerJouni Malinen <j@w1.fi>2019-01-01 19:29:25 (GMT)
commitfb643190dc3ddbcb5c55221ac504eedd5eaf834b (patch)
treec479db86bc52ad60a6220d3418978c42069e7081
parent28ab9344b50577d67a58e488a5b6f4785ad27439 (diff)
downloadhostap-fb643190dc3ddbcb5c55221ac504eedd5eaf834b.zip
hostap-fb643190dc3ddbcb5c55221ac504eedd5eaf834b.tar.gz
hostap-fb643190dc3ddbcb5c55221ac504eedd5eaf834b.tar.bz2
tests: dot1xAuthSessionUserName
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--tests/hwsim/auth_serv/eap_user.conf3
-rw-r--r--tests/hwsim/test_ap_eap.py30
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/hwsim/auth_serv/eap_user.conf b/tests/hwsim/auth_serv/eap_user.conf
index 574af19..b9fc701 100644
--- a/tests/hwsim/auth_serv/eap_user.conf
+++ b/tests/hwsim/auth_serv/eap_user.conf
@@ -150,3 +150,6 @@ radius_accept_attr=26:x:00009f6805170168747470733a2f2f6578616d706c652e636f6d2f
"hs20-t-c-test" TTLS-MSCHAPV2 "password" [2]
radius_accept_attr=26:x:00009f68090601000000
radius_accept_attr=89:s:hs20-cui
+
+"test-user" TTLS-PAP "password" [2]
+radius_accept_attr=1:s:real-user
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index e1ad3f3..c2ab152 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# WPA2-Enterprise tests
-# Copyright (c) 2013-2015, Jouni Malinen <j@w1.fi>
+# Copyright (c) 2013-2019, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
@@ -6472,3 +6472,31 @@ def test_ap_wpa2_eap_psk_mac_addr_change(dev, apdev):
addr2 = dev[0].get_status_field("address")
if addr != addr2:
raise Exception("Failed to restore MAC address")
+
+def test_ap_wpa2_eap_server_get_id(dev, apdev):
+ """Internal EAP server and dot1xAuthSessionUserName"""
+ params = int_eap_server_params()
+ hapd = hostapd.add_ap(apdev[0], params)
+ eap_connect(dev[0], hapd, "TLS", "tls user", ca_cert="auth_serv/ca.pem",
+ client_cert="auth_serv/user.pem",
+ private_key="auth_serv/user.key")
+ sta = hapd.get_sta(dev[0].own_addr())
+ if 'dot1xAuthSessionUserName' not in sta:
+ raise Exception("No dot1xAuthSessionUserName included")
+ user = sta['dot1xAuthSessionUserName']
+ if user != "tls user":
+ raise Exception("Unexpected dot1xAuthSessionUserName value: " + user)
+
+def test_ap_wpa2_radius_server_get_id(dev, apdev):
+ """External RADIUS server and dot1xAuthSessionUserName"""
+ params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
+ hapd = hostapd.add_ap(apdev[0], params)
+ eap_connect(dev[0], hapd, "TTLS", "test-user",
+ anonymous_identity="ttls", password="password",
+ ca_cert="auth_serv/ca.pem", phase2="auth=PAP")
+ sta = hapd.get_sta(dev[0].own_addr())
+ if 'dot1xAuthSessionUserName' not in sta:
+ raise Exception("No dot1xAuthSessionUserName included")
+ user = sta['dot1xAuthSessionUserName']
+ if user != "real-user":
+ raise Exception("Unexpected dot1xAuthSessionUserName value: " + user)