contrib/hostapd/hostapd/ieee802_1x.c
static void ieee802_1x_update_sta_identity(struct hostapd_data *hapd,
					   struct sta_info *sta,
					   struct radius_msg *msg)
{
	u8 *buf, *identity;
	size_t len;
	struct eapol_state_machine *sm = sta->eapol_sm;

	if (sm == NULL)
		return;

	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_USER_NAME, &buf, &len,
				    NULL) < 0)
		return;

	identity = os_malloc(len + 1);
	if (identity == NULL)
		return;

	os_memcpy(identity, buf, len);
	identity[len] = '\0';

	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
		       HOSTAPD_LEVEL_DEBUG, "old identity '%s' updated with "
		       "User-Name from Access-Accept '%s'",
		       sm->identity ? (char *) sm->identity : "N/A",
		       (char *) identity);

	os_free(sm->identity);
	sm->identity = identity;
	sm->identity_len = len;
}
/* Update sta->identity based on User-Name attribute in Access-Accept */
Update sta->identity based on User-Name attribute in Access-Accept
Update sta - > identity based on User - Name attribute in Access - Accept
static void ieee802_1x_update_sta_identity(struct hostapd_data *hapd,
					   struct sta_info *sta,
					   struct radius_msg *msg)
{
	u8 *buf, *identity;
	size_t len;
	struct eapol_state_machine *sm = sta->eapol_sm;
	if (sm == NULL)
		return;
	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_USER_NAME, &buf, &len,
				    NULL) < 0)
		return;
	identity = os_malloc(len + 1);
	if (identity == NULL)
		return;
	os_memcpy(identity, buf, len);
	identity[len] = '\0';
	hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
		       HOSTAPD_LEVEL_DEBUG, "old identity '%s' updated with "
		       "User-Name from Access-Accept '%s'",
		       sm->identity ? (char *) sm->identity : "N/A",
		       (char *) identity);
	os_free(sm->identity);
	sm->identity = identity;
	sm->identity_len = len;
}
static void ieee802_1x_update_sta_identity ( struct hostapd_data * hapd , struct sta_info * sta , struct radius_msg * msg ) { u8 * buf , * identity ; size_t len ; struct eapol_state_machine * sm = sta -> eapol_sm ; if ( sm == NULL ) return ; if ( radius_msg_get_attr_ptr ( msg , RADIUS_ATTR_USER_NAME , & buf , & len , NULL ) < 0 ) return ; identity = os_malloc ( len + 1 ) ; if ( identity == NULL ) return ; os_memcpy ( identity , buf , len ) ; identity [ len ] = ' \0 ' ; hostapd_logger ( hapd , sta -> addr , HOSTAPD_MODULE_IEEE8021X , HOSTAPD_LEVEL_DEBUG , " " " " , sm -> identity ? ( char * ) sm -> identity : " " , ( char * ) identity ) ; os_free ( sm -> identity ) ; sm -> identity = identity ; sm -> identity_len = len ; }
Update sta->identity based on User-Name attribute in Access-Accept
Update sta - > identity based on User - Name attribute in Access - Accept