control flow in FreeRADIUS authorize section

Alan DeKok aland at deployingradius.com
Wed Oct 2 23:32:13 CEST 2013


Bruce Bauman wrote:
> We want to stop executing the <BUNCH OF UNLANG CODE> in the first two
> cases ("infected" and "tempsus"), effectively doing something like a return.

  There is a "return" code.  See doc/configurable_failover.rst:

  ok {
	ok = return
  }

  That may work.  The issue is that there's really no multi-level "stop"
or "break".  i.e. "stop doing ANYTHING, no matter how deeply nested you
are un the conditions.

  The unlang code isn't really meant to do that, sorry.

> I've read the documentation a hundred times and can't figure out how to
> do what I want - everything I've tried doesn't work.
> 
> If someone could give me a simple hint to point me in the right
> direction it would be greatly appreciated.

  A simple thing:


	<infected case>
	update control {
		Tmp-String-0 := "stop"
	}
	...




	if (Tmp-String-0 != "stop") {
         	<BUNCH OF UNLANG CODE>
	}

  That should work.  Ugly, but functional.

  Alan DeKok.


More information about the Freeradius-Users mailing list