From: Jouni Malinen Date: Sat, 16 Mar 2024 09:22:43 +0000 (+0200) Subject: hostapd: Move Message-Authenticator attribute to be the first one in req X-Git-Tag: hostap_2_11~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37fe8e48ab44d44fe3cf5dd8f52cb0a10be0cd17;p=thirdparty%2Fhostap.git hostapd: Move Message-Authenticator attribute to be the first one in req Even if this is not strictly speaking necessary for mitigating certain RADIUS protocol attacks, be consistent with the RADIUS server behavior and move the Message-Authenticator attribute to be the first attribute in the message from RADIUS client in hostapd. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/ieee802_11_auth.c b/src/ap/ieee802_11_auth.c index 98a877dec..cc38044d8 100644 --- a/src/ap/ieee802_11_auth.c +++ b/src/ap/ieee802_11_auth.c @@ -128,6 +128,9 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr, goto fail; } + if (!radius_msg_add_msg_auth(msg)) + goto fail; + os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT, MAC2STR(addr)); if (!radius_msg_add_attr(msg, RADIUS_ATTR_USER_NAME, (u8 *) buf, os_strlen(buf))) { diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 31a112011..8394772c5 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -767,6 +767,9 @@ void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd, goto fail; } + if (!radius_msg_add_msg_auth(msg)) + goto fail; + if (sm->identity && !radius_msg_add_attr(msg, RADIUS_ATTR_USER_NAME, sm->identity, sm->identity_len)) {