aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-01-01 19:27:54 (GMT)
committerJouni Malinen <j@w1.fi>2019-01-01 19:27:54 (GMT)
commit28ab9344b50577d67a58e488a5b6f4785ad27439 (patch)
treeb59a5f095944819f6c6ab449f7109621de71ec09 /src
parenta139ddb6cd6a294c58fec3f8f821ef235b4b8eb6 (diff)
downloadhostap-28ab9344b50577d67a58e488a5b6f4785ad27439.zip
hostap-28ab9344b50577d67a58e488a5b6f4785ad27439.tar.gz
hostap-28ab9344b50577d67a58e488a5b6f4785ad27439.tar.bz2
Use internal EAP server identity as dot1xAuthSessionUserName
If the internal EAP server is used instead of an external RADIUS server, sm->identity does not get set. Use the identity from the internal EAP server in such case to get the dot1xAuthSessionUserName value in STA MIB information. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r--src/ap/ieee802_1x.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index efcbe6f..68d3a81 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1,6 +1,6 @@
/*
* hostapd / IEEE 802.1X-2004 Authenticator
- * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2019, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -2596,6 +2596,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
struct os_reltime diff;
const char *name1;
const char *name2;
+ char *identity_buf = NULL;
if (sm == NULL)
return 0;
@@ -2711,6 +2712,14 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
/* dot1xAuthSessionStatsTable */
os_reltime_age(&sta->acct_session_start, &diff);
+ if (sm->eap && !sm->identity) {
+ const u8 *id;
+ size_t id_len;
+
+ id = eap_get_identity(sm->eap, &id_len);
+ if (id)
+ identity_buf = dup_binstr(id, id_len);
+ }
ret = os_snprintf(buf + len, buflen - len,
/* TODO: dot1xAuthSessionOctetsRx */
/* TODO: dot1xAuthSessionOctetsTx */
@@ -2726,7 +2735,8 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
wpa_auth_sta_key_mgmt(sta->wpa_sm))) ?
1 : 2,
(unsigned int) diff.sec,
- sm->identity);
+ sm->identity ? (char *) sm->identity : identity_buf);
+ os_free(identity_buf);
if (os_snprintf_error(buflen - len, ret))
return len;
len += ret;