Why does 'switch' and case don't work?

luckydog xf luckydogxf at gmail.com
Wed Nov 22 02:34:29 CET 2017


:) Just to be clear, FreeRADIUS is a GREAT stuff.

Yes using if/elsif/else works,  yet i'm curious why switch and case
combination doesn't.

$LDAP-Group in switch statement expands nothing from `raidus -X`, in other
words, LDAP-Group is null, that's why it always goes down to `default` of
case statement.

.

On Tue, Nov 21, 2017 at 9:15 PM, Alan DeKok <aland at deployingradius.com>
wrote:

> On Nov 21, 2017, at 4:54 AM, luckydog xf <luckydogxf at gmail.com> wrote:
> >   switch statement in post-auth section doesn't work, see below.
>
>   Yes, they do work.  There are tests that run every day for them.
>
> > =============
> > switch &LDAP-Group {
>
>   You can't look at the value of LDAP-Group like that.  You can do:
>
>         if (LDAP-Group == "admins") ...
>
>   That checks of the user is part of the "admins" group.  But the user may
> be part of tens to thousands of LDAP groups.  All of those values are
> stored in the LDAP server, not in FreeRADIUS
>
>   Change the "switch" to use if / else, and it will work.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/
> list/users.html
>


More information about the Freeradius-Users mailing list