Hi,

Thanks - that was just was just what I was looking for, although I assume something like the following would go into /etc/freeradius/sites-enabled/default

authorize
{
...
 ntlm_auth
        {
                if (User-Password =~ /^(.+)([0-9]{6})$/) {

                 update request {
                 User-Password = "%{1}"
                 Some-PIN-Attr = "%{2}"
                }
        }
        }
...

Although it complains in the debug (radiusd -XXX) about the following:

Wed Apr 17 12:47:23 2013 : Debug: including configuration file /etc/freeradius/sites-enabled/default
Wed Apr 17 12:47:23 2013 : Error: /etc/freeradius/sites-enabled/default[216]: Too many closing braces
Wed Apr 17 12:47:23 2013 : Error: Errors reading /etc/freeradius/radiusd.conf



On Wed, Apr 17, 2013 at 12:00 PM, Phil Mayers <p.mayers@imperial.ac.uk> wrote:
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: http://freeradius.org/radiusd/man/unlang.html#lbAB
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)

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html