update RAD_REPLY with += in rlm_perl

Bjørn Mork bjorn at mork.no
Tue Oct 25 14:16:07 CEST 2011

Energ <ponch at ponch.ru> writes:

> how do i update RAD_REPLY correctly with perl if i want to add addtiotional
> Cisco-AVPair in reply?
> lets say user profile has Cisco-AVPair="something1". I can have multiple of
> those by adding to user profile another pair like this
> Cisco-AVPair+="something1". But how to do the same while processing with
> rlm_perl? How to hablde hash update in this situation?

multiple values for the same attribute are represented as an arrayref in

  $RAD_REPLY{'Cisco-AVPair'} = [ 'value1', 'value2', value3 ];

which equivalent to

  Cisco-AVPair := value1,
  Cisco-AVPair += value2
  Cisco-AVPair += value3

This can become a bit messy if you have to change the number of values
between 1 and a higher number, since you then have to change the type
between a scalar and an arrayref.


More information about the Freeradius-Users mailing list