Foreach-Variable-X and =~

Phil Mayers p.mayers at imperial.ac.uk
Fri May 16 15:58:48 CEST 2014


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?


More information about the Freeradius-Users mailing list