Hi All. I have some code in an "sql" policy: sql_check_user_present { update control { Tmp-String-0 := "%{sql_pwifi:SELECT COUNT(*) from voucher v left join state s on v.id=s.voucher_id where v.id=s.voucher_id and v.code='%{User-Name}' and (s.state='Inactive' or s.state='Active')}" } switch "%{control:Tmp-String-0}" { case "0" { update control { User-RejectInformation := "Sorry, that voucher code is invalid or has expired." Debug-RejectInformation := "Voucher code not present in database table, or voucher expired" } reject } case "1" { noop } case { # voucher has multiple table entries, oooh errr. update control { User-RejectInformation := "Sorry, there has been an error. Please contact IT." Debug-RejectInformation := "Multiple voucher codes the same, or database error - SQL count not = 0 or 1. This should never happen due to primary key constraint!" } reject } } }
This works fine in 3.0, git version #f66d411, but I have a problem with a regex related thing causing a segfault in that version and wouldn't mind trying the latest version to see if it's fixed. Trying version #d166290 results in /usr/local/etc/raddb/policy.d/sql[6]: "case" statements may only appear within a "switch" section /usr/local/etc/raddb/policy.d/sql[6]: Failed to parse "case" subsection. /usr/local/etc/raddb/policy.d/sql[5]: Failed to parse "switch" subsection. /usr/local/etc/raddb/sites-enabled/default[220]: Errors parsing authorize section. Do I need to change how the switch statement works? The unlang page doesn't seem to have changed as far as I can tell. Thanks Andy
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html