hints file based rewrite does not work (migration from freeradius 1.1.x to 3.0.x)

Herwin Weststrate herwin at quarantainenet.nl
Mon Oct 12 16:57:17 CEST 2015


On 12-10-15 16:43, Bernd wrote:
> Am 2015-10-12 16:23, schrieb Alan DeKok:
>> On Oct 12, 2015, at 10:08 AM, Bernd <bernd at kroenchenstadt.de> wrote:
>>>
>>> Thanks a lot for your reply, Alan. I deleted it from hints and put
>>> your snippet into the config, however I still get that error:
>>
>>   Escape the % with a backslash.
> 
> Escaped all %'s with a backslash, same problem.

Actually, the % should not be escaped with a slash, but with another %.
The problem here isn't regex escaping, but xlat that tries to expand the
% variable.

The following piece of code should work:

  if (User-Name =~ /bla-bla\/([^%%]+)%%kroenchenstadt.de/) {
    update control {
      User-Name := "%{1}@kroenchenstadt.de"
    }
  }

There is no need to escape the hyphen in regex either, so I've removed
that escape too. I've tested it with 3.0.10.

-- 
Herwin Weststrate



More information about the Freeradius-Users mailing list