unlang question

Enrik Berkhan enrik#freeradius at planb.de
Fri Jul 6 11:44:45 CEST 2007


Hi,

Alan DeKok wrote:
>   Yes.  The solution, I think, is to *not* put logic into the
> "authenticate" section.
> 
>   As I said before, put it in "post-auth", where it belongs.

Another artificial example that might surprise the novice unlang user:

> modules {
> 
>   always always-ok {
>     rcode = ok
>   }
>   always always-reject {
>     rcode = reject
>   }
> 
> }
> 
> server {
> 
>   authorize {
> 
>     # reject, but continue
>     always-reject {
>       reject = 1
>     }
> 
>     if (ok) {
>       update reply {
>         Reply-Message := '%{User-Name:-unknown} authorized!'
>       }
>       always-ok
>     }
>     elsif (reject) {
>       update reply {
>         Reply-Message := "Go away, %{User-Name:-unknown}!"
>       }
>       always-reject
>     }
> 
>   }
> 
> }

Here, again, the elsif will never be considered. Really, it's an unlang
... :)

Enrik



More information about the Freeradius-Devel mailing list