multiattribute testing in git 1411859
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Tue Aug 12 16:56:55 CEST 2014
On 11 Aug 2014, at 07:44, Franks Andy (RLZ) IT Systems Engineer <Andy.Franks at sath.nhs.uk> wrote:
> Hi Alan,
> Thanks for responding. There seemed to be a bug in foreach, which is
> why I just put some code together and sent it over to Arran; on the
> version I was running, if you "do" an if statement before a foreach
> section, it seems to make other instances of foreach called later behave
> oddly, which is what I wanted to demonstrate with the policy. It works
> fine in isolation, or without the if statement, and didn't need to be a
> policy as such, it just worked from an inclusion of a standalone section
> of unlang if that makes sense.
radiusd: #### Loading Virtual Servers ####
server { # from file src/tests/keywords//radiusd.conf
} # server
server default { # from file src/tests/keywords//radiusd.conf
# Loading authenticate {...}
# Loading authorize {...}
} # server default
User-Name = 'bob'
User-Password = 'hello'
(0) server default {
(0) Request:
User-Name = 'bob'
User-Password = 'hello'
(0) # Executing section authorize from file src/tests/keywords//radiusd.conf
(0) authorize {
(0) update control {
(0) Cleartext-Password := 'hello'
(0) } # update control = noop
(0) update control {
(0) Tmp-String-0 := 'ssid=ABCDEF'
(0) Tmp-String-0 += 'ssid=GHIJKL'
(0) } # update control = noop
(0) if (User-Name)
(0) if (User-Name) -> TRUE
(0) if (User-Name) {
(0) foreach control:Tmp-String-0
(0) # Foreach-Variable-0 = "ssid=ABCDEF"
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/)
(0) EXPAND %{Foreach-Variable-0}
(0) --> ssid=ABCDEF
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) -> TRUE
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) {
(0) update control {
(0) EXPAND %{1}
(0) --> ssid=ABCDEF
(0) Tmp-String-1 := "ssid=ABCDEF"
(0) } # update control = noop
(0) } # if ("%{Foreach-Variable-0}" =~ /(.*)/) = noop
(0) # Foreach-Variable-0 = "ssid=GHIJKL"
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/)
(0) EXPAND %{Foreach-Variable-0}
(0) --> ssid=GHIJKL
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) -> TRUE
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) {
(0) update control {
(0) EXPAND %{1}
(0) --> ssid=GHIJKL
(0) Tmp-String-1 := "ssid=GHIJKL"
(0) } # update control = noop
(0) } # if ("%{Foreach-Variable-0}" =~ /(.*)/) = noop
(0) } # foreach control:Tmp-String-0 = noop
(0) } # if (User-Name) = noop
(0) foreach control:Tmp-String-0
(0) # Foreach-Variable-1 = "ssid=ABCDEF"
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/)
(0) EXPAND %{Foreach-Variable-0}
(0) --> UNKNOWN-TYPE
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) -> TRUE
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/) {
(0) update control {
(0) EXPAND %{1}
(0) --> UNKNOWN-TYPE
(0) Tmp-String-1 := "UNKNOWN-TYPE"
(0) } # update control = noop
(0) } # if ("%{Foreach-Variable-0}" =~ /(.*)/) = noop
(0) # Foreach-Variable-1 = "ssid=GHIJKL"
(0) if ("%{Foreach-Variable-0}" =~ /(.*)/)
CAUGHT SIGNAL: Segmentation fault: 11
Backtrace of last 24 frames:
0 libfreeradius-radius.dylib 0x00000001019e8f20 fr_fault + 256
1 libsystem_platform.dylib 0x00007fff8abfe5aa _sigtramp + 26
2 ??? 0x00007fb0fa003660 0x0 + 140398085289568
3 libfreeradius-radius.dylib 0x00000001019fc29b vp_prints_value + 75
4 libfreeradius-server.dylib 0x00000001019c63a5 xlat_foreach + 133
5 libfreeradius-server.dylib 0x00000001019c9d85 xlat_aprint + 1909
6 libfreeradius-server.dylib 0x00000001019c92f2 xlat_process + 162
7 libfreeradius-server.dylib 0x00000001019c9164 xlat_expand_struct + 100
8 libfreeradius-server.dylib 0x00000001019c90f2 radius_axlat_struct + 66
9 libfreeradius-server.dylib 0x00000001019b342d radius_expand_tmpl + 621
10 libfreeradius-server.dylib 0x00000001019b4cda do_regex + 522
11 libfreeradius-server.dylib 0x00000001019b3d4d radius_evaluate_map + 1997
12 libfreeradius-server.dylib 0x00000001019b4f9f radius_evaluate_cond + 159
13 unittest 0x0000000101958122 modcall_recurse + 386
14 unittest 0x0000000101958db8 modcall_recurse + 3608
15 unittest 0x000000010195f5a9 modcall_child + 185
16 unittest 0x0000000101959245 modcall_recurse + 4773
17 unittest 0x0000000101957f52 modcall + 178
18 unittest 0x00000001019553f3 indexed_modcall + 579
19 unittest 0x0000000101957122 process_authorize + 34
20 unittest 0x000000010194cead rad_authenticate + 509
21 unittest 0x000000010194e05d rad_virtual_server + 157
22 unittest 0x000000010195ff0a main + 2010
23 libdyld.dylib 0x00007fff8b1895fd start + 1
Calling: lldb -f ./build/bin/local/unittest -p 97277 1>&0 2>&0
Panic action exited with 0
_EXIT(1) CALLED /Users/arr2036/Documents/Repositories/freeradius-server-master/src/lib/debug.c[659]. Last error was: Getting value of PR_DUMPABLE not supported on this system
# build/tests/keywords/foreach-in-if.log
make: *** [build/tests/keywords/foreach-in-if] Error 1
The actual testcase would look something like:
update control {
Tmp-String-0 := "ssid=ABCDEF"
Tmp-String-0 += "ssid=GHIJKL"
}
if (User-Name) {
foreach control:Tmp-String-0 {
if ("%{Foreach-Variable-0}" =~ /(.*)/) {
update control {
Tmp-String-1 := "%{1}"
}
}
}
}
if (Tmp-String-1 != 'ssid=GHIJKL') {
update reply {
Filter-Id += 'fail 0'
}
}
update control {
Tmp-String-1 !* ANY
}
foreach control:Tmp-String-0 {
if ("%{Foreach-Variable-0}" =~ /(.*)/) {
update control {
Tmp-String-1 := "%{1}"
}
}
}
if (Tmp-String-1 != 'ssid=GHIJKL') {
update reply {
Filter-Id += 'fail 1'
}
}
update control {
Tmp-String-1 !* ANY
}
-Arran
Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team
FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140812/8d5ebe33/attachment.pgp>
More information about the Freeradius-Users
mailing list