Hi, Currently, I'm playing with freeradius 2 to evaluate the new unlang features (using CVS source from today). I figured out the following setup for an unlang if-else construct matching on a module return. I'm just wondering if this is the most elegant solution currently possible. Comments welcome.
server {
authorize { if ("%{NAS-IP-Address}" == '') { update request { NAS-IP-Address = "%{Client-IP-Address}" } } auth_log users pap }
authenticate { Auth-Type PAP { pap { ok = 1 # don't stop processing reject = 1 } if (reject) { ok = 1 # preserve PAP result in case the if-clause evaluates to false update reply { Reply-Message := "Wrong PAP password." } } elsif (ok) { update reply { Reply-Message := "Welcome." } } } }
}
Enrik