| 1 |
# |
| 2 |
# PRE: if |
| 3 |
# |
| 4 |
|
| 5 |
update reply { |
| 6 |
Filter-Id := "filter" |
| 7 |
} |
| 8 |
|
| 9 |
if ("%{Client-Shortname}" != '<UNKNOWN-CLIENT>') { |
| 10 |
update reply { |
| 11 |
Filter-Id += "fail 0" |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
if ("%{Request-Processing-Stage}" != 'authorize') { |
| 16 |
update reply { |
| 17 |
Filter-Id += "fail 1" |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
if ("%{Virtual-Server}" != 'default') { |
| 22 |
update reply { |
| 23 |
Filter-Id += "fail 2" |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
if ("%{Module-Return-Code}" != '') { |
| 28 |
update reply { |
| 29 |
Filter-Id += "fail 3a" |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
ok |
| 34 |
if ("%{Module-Return-Code}" != 'ok') { |
| 35 |
update reply { |
| 36 |
Filter-Id += "fail 3b" |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if ("%{Packet-Type}" != 'Access-Request') { |
| 41 |
update reply { |
| 42 |
Filter-Id += "fail 4" |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
# Response hasn't been set yet |
| 47 |
if ("%{Response-Packet-Type}" != '') { |
| 48 |
update reply { |
| 49 |
Filter-Id += "fail 5" |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
if ("%{Packet-Authentication-Vector}" != '0x00000000000000000000000000000000') { |
| 54 |
update reply { |
| 55 |
Filter-Id += "fail 6" |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
if ("%{Client-IP-Address}" != 127.0.0.1) { |
| 60 |
update reply { |
| 61 |
Filter-Id += "fail 7a" |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
if ("%{Packet-Src-IP-Address}" != 127.0.0.1) { |
| 66 |
update reply { |
| 67 |
Filter-Id += "fail 7b" |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
if ("%{Packet-Dst-IP-Address}" != 127.0.0.1) { |
| 72 |
update reply { |
| 73 |
Filter-Id += "fail 8" |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
# Can't have both... |
| 78 |
if ("%{Packet-Src-IPv6-Address}" != '') { |
| 79 |
update reply { |
| 80 |
Filter-Id += "fail 9" |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
if ("%{Packet-Dst-IPv6-Address}" != '') { |
| 85 |
update reply { |
| 86 |
Filter-Id += "fail 10" |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if ("%{Packet-Src-Port}" != '18120') { |
| 91 |
update reply { |
| 92 |
Filter-Id += "fail 11" |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
if ("%{Packet-Dst-Port}" != '1812') { |
| 97 |
update reply { |
| 98 |
Filter-Id += "fail 12" |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
# We should allow the user to overload virtual attributes |
| 104 |
update request { |
| 105 |
Client-Shortname := 'my_test_client' |
| 106 |
} |
| 107 |
|
| 108 |
if ("%{Client-Shortname}" != 'my_test_client') { |
| 109 |
update reply { |
| 110 |
Filter-Id += "fail 13" |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
# Operations on virtual attributes should be the same as on real ones |
| 115 |
if ("%{Virtual-Server[0]}" != 'default') { |
| 116 |
update reply { |
| 117 |
Filter-Id += "fail 14" |
| 118 |
} |
| 119 |
} |
| 120 |
|
| 121 |
if ("%{Virtual-Server[*]}" != 'default') { |
| 122 |
update reply { |
| 123 |
Filter-Id += "fail 15" |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
if ("%{Virtual-Server[#]}" != 1) { |
| 128 |
update reply { |
| 129 |
Filter-Id += "fail 16" |
| 130 |
} |
| 131 |
} |