aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/accounting.c
diff options
context:
space:
mode:
authorMichael Braun <michael-dev@fami-braun.de>2012-08-19 11:27:30 (GMT)
committerJouni Malinen <j@w1.fi>2012-08-19 11:27:30 (GMT)
commitbe9e8c293caee7d08257da1807fd9c20f4af61c3 (patch)
treec6ce21cd1b9c67da3465fe4f97661a7bc63a88b6 /src/ap/accounting.c
parent1a819aa7d5ab9bbdd0dd33f2d9e0911edeb2a2f7 (diff)
downloadhostap-be9e8c293caee7d08257da1807fd9c20f4af61c3.zip
hostap-be9e8c293caee7d08257da1807fd9c20f4af61c3.tar.gz
hostap-be9e8c293caee7d08257da1807fd9c20f4af61c3.tar.bz2
Add User-Name/CUI from RADIUS ACL in Accounting messages
This allows User-Name and Chargeable-User-Identity attributes to be passed from Access-Accept into Accounting messages even when IEEE 802.1X is not used. Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
Diffstat (limited to 'src/ap/accounting.c')
-rw-r--r--src/ap/accounting.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ap/accounting.c b/src/ap/accounting.c
index 8c60d0e..7563b52 100644
--- a/src/ap/accounting.c
+++ b/src/ap/accounting.c
@@ -81,7 +81,17 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
}
if (sta) {
+ /* Use 802.1X identity if available */
val = ieee802_1x_get_identity(sta->eapol_sm, &len);
+
+ /* Use RADIUS ACL identity if 802.1X provides no identity */
+ if (!val && sta->identity) {
+ val = (u8 *) sta->identity;
+ len = os_strlen(sta->identity);
+ }
+
+ /* Use STA MAC if neither 802.1X nor RADIUS ACL provided
+ * identity */
if (!val) {
os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT,
MAC2STR(sta->addr));
@@ -122,6 +132,15 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
wpa_printf(MSG_ERROR, "Could not add CUI");
goto fail;
}
+
+ if (!b && sta->radius_cui &&
+ !radius_msg_add_attr(msg,
+ RADIUS_ATTR_CHARGEABLE_USER_IDENTITY,
+ (u8 *) sta->radius_cui,
+ os_strlen(sta->radius_cui))) {
+ wpa_printf(MSG_ERROR, "Could not add CUI from ACL");
+ goto fail;
+ }
}
return msg;