| 1 |
# |
| 2 |
# PRE: update |
| 3 |
# |
| 4 |
# Remove all attributes in a list |
| 5 |
# |
| 6 |
update { |
| 7 |
control:Cleartext-Password := 'hello' |
| 8 |
reply:Filter-Id := 'filter' |
| 9 |
} |
| 10 |
|
| 11 |
update { |
| 12 |
request:Tmp-String-0 := 'foobarbaz' |
| 13 |
request:Tmp-Integer-0 := 123456789 |
| 14 |
request:Tmp-IP-Address-0 := 192.0.2.1 |
| 15 |
request:Tmp-IP-Address-0 += 192.0.2.2 |
| 16 |
control:Tmp-IP-Address-0 := 192.0.2.1 |
| 17 |
control:Tmp-IP-Address-0 += 192.0.2.3 |
| 18 |
} |
| 19 |
|
| 20 |
if (("%{Tmp-IP-Address-0[0]}" != 192.0.2.1) || ("%{Tmp-IP-Address-0[1]}" != 192.0.2.2)) { |
| 21 |
update { |
| 22 |
reply:Filter-Id := 'fail 1' |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
# Remove all attributes in the control list |
| 27 |
update { |
| 28 |
request:Tmp-IP-Address-0 !* ANY |
| 29 |
} |
| 30 |
|
| 31 |
# Non Tmp-IP-Address-0 address attributes should still be in the request list |
| 32 |
if ((Tmp-String-0 != 'foobarbaz') || (Tmp-Integer-0 != 123456789)) { |
| 33 |
update reply { |
| 34 |
reply:Filter-Id += 'fail 2' |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
# There should be no Tmp-IP-Address attributes in the request list |
| 39 |
if (Tmp-IP-Address-0 || ("%{Tmp-IP-Address-0[1]}" != '')) { |
| 40 |
update { |
| 41 |
reply:Filter-Id += 'fail 3' |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
# But there should still be some in the control list |
| 46 |
if ((control:Tmp-IP-Address-0 != 192.0.2.1) || ("%{control:Tmp-IP-Address-0[1]}" != 192.0.2.3)) { |
| 47 |
update { |
| 48 |
reply:Filter-Id += 'fail 4' |
| 49 |
} |
| 50 |
} |