unlang question
Enrik Berkhan
enrik#freeradius at planb.de
Wed Jul 4 19:14:28 CEST 2007
Hi,
Alan DeKok schrieb:
> Enrik Berkhan wrote:
>>> reject = 1
>>> }
>>> if (reject) {
>>> ok = 1 # preserve PAP result in case the if-clause evaluates to false
>
> This will not work: "if" is not a module. The comment is also wrong.
But exactly adding the "ok = 1" makes it work. Have you tried it? May be
it's a bug though ... :)
> The contents of the "if" block are evaluated ONLY if the "if" evaluates
> to true. So setting "ok = 1" (even if it worked) would happen only when
> the "if" evaluates to true.
But it takes something from the child block after the unroll: label in
modcall.c. That's why I have tried the above. Maybe this is not correct
for if/elsif?
> unroll:
> /*
> * The child's action says return. Do so.
> */
> if (child->actions[myresult] == MOD_ACTION_RETURN) {
Actually, I've changed it to "ok = 2" to override the "updated" return
from the Reply-Message update in the elsif section.
> What you probably want here is:
>
> pap {
> ok = 1
> reject = 1
> }
> if (ok) {
> update reply {
> Reply-Message := "Welcome."
> }
>
> }
> elsif (reject) {
> update reply {
> Reply-Message := "Wrong PAP password."
> }
> reject # over-rides the "updated" flag.
> }
> ....
You are right, that's like I wanted it, but it didn't work. So may be
the if-processing is still buggy then.
Enrik
More information about the Freeradius-Devel
mailing list