[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-users
Subject:    Re: Why does 'switch' and case don't work?
From:       luckydog xf <luckydogxf () gmail ! com>
Date:       2017-11-22 1:34:29
Message-ID: CAAoCYOwDpKLowxu_J2YAXrXFgxJZQRU1xKUvsASUWU1+OWADBQ () mail ! gmail ! com
[Download RAW message or body]

:) 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@deployingradius.com>
wrote:

> On Nov 21, 2017, at 4:54 AM, luckydog xf <luckydogxf@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
>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic