It works for me with a 3.0.2 FRD. I have a few differences in syntax, I'm not sure if it's important... Here is what I have: foreach Cisco-AVPair { if ("%{Foreach-Variable-0}" =~ /^circuit-id-tag=(.+)/ ) { update control { SRS-Cisco-Circuit-Id = "%{1}" }
-----Message d'origine----- De : freeradius-users- bounces+nicolas.chaigneau=capgemini.com@lists.freeradius.org [mailto:freeradius-users- bounces+nicolas.chaigneau=capgemini.com@lists.freeradius.org] De la part de Phil Mayers Envoyé : vendredi 16 mai 2014 15:59 À : FreeRadius users mailing list Objet : Foreach-Variable-X and =~
Does this work for anyone else? I'm running 3.0.x HEAD, and finding that this:
if (Cisco-AVPair) { foreach &Cisco-AVPair { if (Foreach-Variable-0 =~ /^audit-session-id=(.+)$/) { update request { IC-Cisco-ASID := "%{1}" } } } }
...doesn't work; with a packet of:
Received Access-Request Id 10 from ... Cisco-AVPair = 'blah=foo' Cisco-AVPair = 'audit-session-id=foo'
...I get:
(10) if (Cisco-AVPair) (10) if (Cisco-AVPair) -> TRUE (10) if (Cisco-AVPair) { (10) foreach &Cisco-AVPair (10) update request { (10) EXPAND %{Foreach-Variable-0} (10) --> blah=foo (10) Tmp-String-0 := '"blah=foo"' (10) } # update request = noop (10) if (Foreach-Variable-0 =~ /^audit-session-id=(.+)$/) (10) if (Foreach-Variable-0 =~ /^audit-session-id=(.+)$/) -> FALSE (10) update request { (10) EXPAND %{Foreach-Variable-0} (10) --> audit-session-id=foo (10) Tmp-String-0 := '"audit-session-id=foo"' (10) } # update request = noop (10) if (Foreach-Variable-0 =~ /^audit-session-id=(.+)$/) (10) if (Foreach-Variable-0 =~ /^audit-session-id=(.+)$/) -> FALSE (10) } # foreach &Cisco-AVPair = noop (10) } # if (Cisco-AVPair) = noop
...but it works if I copy Foreach-Variable-0 to Tmp-String-0 and do the regexp against that.
Before I dig any deeper, just wanted to see if it actually works for anyone? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.