Trimming character of variables within configuration files

Phil Mayers p.mayers at
Wed Apr 17 13:00:01 CEST 2013

On 17/04/13 11:45, P. Manton wrote:
> Is there a way I could trim a variable (such as a password variable)
> within a configuration file. I saw a few examples manipulating variables
> using unlang here:
> but could not find anything about trimming variables.

Use a regexp:

authorize {
   if (User-Password =~ /^(.+)([0-9]{6})$/) {
     update request {
       User-Password = "%{1}"
       Some-PIN-Attr = "%{2}"

If you mean "trim when expanding" you can't; you must transform the 
variable into another one, then use that. If you don't want to mangle 
User-Password, define another attribute in the dictionary, taking note 
of the correct attribute numbers to use (as defined in the comments)

More information about the Freeradius-Users mailing list