Hello, I would like to reject pre-proxy some specific users by querying the mysql database. I've created a table with these users that will be rejected. In policy.d/filter This rule worked. filter_user { if (&User-Name == 'XXX@XXX') { reject } } But I want to query these users in the database. I tried. filter_user { if ("%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}" == &User-Name) { reject } } Error: policy.d/filter[20]: Parse error in condition policy.d/filter[20]: ("%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}" == &User-Name) { policy.d/filter[20]: ^ Cannot use attribute reference on right side of condition What would be the best way to do this filter? thank you all
On 1 April 2018 14:30:30 BST, Andrei Antonelli <andreirp@gmail.com> wrote:
if (&User-Name == 'XXX@XXX') { reject
&User-Name on the LHS.
if ("%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}" == &User-Name) {
&User-Name on the RHS.
policy.d/filter[20]: ^ Cannot use attribute reference on right side of condition
What would be the best way to do this filter?
Attribute needs to be on the left, just like the error says. if (&User-Name == "%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}") { -- Matthew
Thanks a lot Matthew. Worked. -- Att. Andrei Antoneli On Sun, Apr 1, 2018 at 11:28 AM, Matthew Newton <mcn@freeradius.org> wrote:
On 1 April 2018 14:30:30 BST, Andrei Antonelli <andreirp@gmail.com> wrote:
if (&User-Name == 'XXX@XXX') { reject
&User-Name on the LHS.
if ("%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}" == &User-Name) {
&User-Name on the RHS.
policy.d/filter[20]: ^ Cannot use attribute reference on right side of condition
What would be the best way to do this filter?
Attribute needs to be on the left, just like the error says.
if (&User-Name == "%{sql:SELECT username FROM radcheckblock WHERE username = '%{User-Name}'}") {
-- Matthew
- List info/subscribe/unsubscribe? See http://www.freeradius.org/ list/users.html
participants (2)
-
Andrei Antonelli -
Matthew Newton