Skip to content

Commit

Permalink
Merge pull request #206 from CristiCimpianu/master
Browse files Browse the repository at this point in the history
add override of username if received in an Access-Accept packet
  • Loading branch information
jobezic authored Sep 16, 2016
2 parents c7b4cc8 + deb825a commit 2291edf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/chilli.c
Original file line number Diff line number Diff line change
Expand Up @@ -4425,6 +4425,7 @@ int cb_radius_auth_conf(struct radius_t *radius,

struct radius_attr_t *stateattr = NULL;
struct radius_attr_t *classattr = NULL;
struct radius_attr_t *uidattr = NULL;

#ifdef ENABLE_RADPROXY
int instance = 0;
Expand Down Expand Up @@ -4671,6 +4672,18 @@ int cb_radius_auth_conf(struct radius_t *radius,
syslog(LOG_DEBUG, "Received RADIUS Access-Accept");
#endif

if (!radius_getattr(pack, &uidattr, RADIUS_ATTR_USER_NAME, 0, 0, 0)) {
if (uidattr->l-2 < USERNAMESIZE) {
memcpy(appconn->s_state.redir.username,
(char *)uidattr->v.t, uidattr->l-2);
appconn->s_state.redir.username[uidattr->l-2]=0;
}
#if(_debug_)
if (_options.debug)
syslog(LOG_DEBUG, "Received User-Name override from RADIUS Access-Accept: %s", appconn->s_state.redir.username);
#endif
}

/* Class */
if (!radius_getattr(pack, &classattr, RADIUS_ATTR_CLASS, 0, 0, 0)) {
appconn->s_state.redir.classlen = classattr->l-2;
Expand Down

0 comments on commit 2291edf

Please sign in to comment.