| 1 |
# |
| 2 |
# PRE: update update-remove-index |
| 3 |
# |
| 4 |
# A more generic "update" mechanism |
| 5 |
# |
| 6 |
update { |
| 7 |
control:Cleartext-Password := 'hello' |
| 8 |
reply:Filter-Id := "filter" |
| 9 |
} |
| 10 |
|
| 11 |
update { |
| 12 |
control:Reply-Message += 'a' |
| 13 |
control:Reply-Message += 'b' |
| 14 |
control:Reply-Message += 'c' |
| 15 |
} |
| 16 |
|
| 17 |
if ((&control:Reply-Message[0] != 'a') || (&control:Reply-Message[1] != 'b') || (&control:Reply-Message[2] != 'c')) { |
| 18 |
update { |
| 19 |
reply:Filter-Id := 'Fail 0' |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
# Overwrite a specific index, and check the value here is replaced |
| 24 |
update { |
| 25 |
&control:Reply-Message[1] := 'd' |
| 26 |
} |
| 27 |
|
| 28 |
if ((&control:Reply-Message[0] != 'a') || (&control:Reply-Message[1] != 'd') || (&control:Reply-Message[2] != 'c')) { |
| 29 |
update { |
| 30 |
reply:Filter-Id := 'Fail 1' |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
# Check isolation... |
| 35 |
update { |
| 36 |
&control:Reply-Message[0] := &control:Reply-Message[0] |
| 37 |
} |
| 38 |
|
| 39 |
if ((&control:Reply-Message[0] != 'a') || (&control:Reply-Message[1] != 'd') || (&control:Reply-Message[2] != 'c')) { |
| 40 |
update { |
| 41 |
reply:Filter-Id := 'Fail 2' |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
# Verify we haven't acquired any extra.. |
| 46 |
|
| 47 |
if ("%{control:Reply-Message[#]}" != 3) { |
| 48 |
update { |
| 49 |
reply:Filter-Id := 'Fail 3' |
| 50 |
} |
| 51 |
} |
| 52 |
|