Re: freeradius 3.2.5 - sql module with if fail ok - still fails the entire authorize section

Alan DeKok via Freeradius-Users <[email protected]>
Newsgroups gmane.comp.freeradius.user
Message-ID <[email protected]>
On Aug 16, 2025, at 8:17 AM, Ricardo Esteves <[email protected]> wrote:
> I'm having an issue with sql module, i want to continue in the authorize section even if the sql module fails, but is not working.
> 
> I have this in the authorize section:
> 
>         sql
>         if (fail) {
>                 ok
>         }
> 
> When i try radtest i see that the sql module fails (when my mysql is down) but the if condition is not respected and entire authorize section fails:

  The "fail" result causes the "authorize" section to the stopped.  That's by design.

> Anyone has any idea what might be wrong?

  Nothing is wrong.

  If you want to override the fail, you have two options:

	#  if SQL fails, then run "ok"
	redundant {
		sql
		ok
	}

or

	sql {
		fail = 2  # over-rides the "stop on fail"
	}
	if (fail) {
		ok
	}

  Alan DeKok.

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.