Cast type user-name

Bassem Mettichi mettichi at gmail.com
Mon Apr 18 07:26:05 UTC 2022


Thanks a lot it is working now, the issue was the { at the second line

for every one who need to check IPV4 and IPV6 below the configuration

if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/) {
           .....
        }
       elsif (User-Name =~
/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^::(?:[0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}$|^[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4}::(?:[0-9a-fA-F]{1,4}:)?[0-9a-fA-F]{1,4}$|(?:[0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4}::[0-9a-fA-F]{1,4}$|^(?:[0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}::$/)
{
           .....
        }

Le dim. 17 avr. 2022 à 13:11, Nathan Ward <lists+freeradius at daork.net> a
écrit :

> Try put the { on the end of the if line, I have a vague recollection that
> that’s a thing.
>
> Otherwise - post the log (not just that line).
>
> > On 17/04/2022, at 9:48 PM, Bassem Mettichi <mettichi at gmail.com> wrote:
> >
> > sorry by mistake i have writen this: if (User-Name =~
> > \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
> >
> > but what i use actually on my freeradius server is this:
> >
> > if (User-Name =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/)
> >
> >
> > and i get the same error message:
> >
> > Failed to find "{" as a module or policy.
> >
> >
> > Le dim. 17 avr. 2022 à 10:33, Nathan Ward <lists+freeradius at daork.net> a
> > écrit :
> >
> >> I haven’t read the regex itself to see if it makes sense, but / is not
> \ -
> >> so start there.
> >>
> >>> On 17/04/2022, at 9:31 PM, Bassem Mettichi <mettichi at gmail.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> i have used this regex for ipv4addr
> >>>
> >>>
> >>> if (User-Name =~ \^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$\)
> >>>
> >>> {
> >>>
> >>> }
> >>>
> >>>
> >>> but when i try to start freeradius i get this error message:
> >>>
> >>>
> >>> default[424]: Failed to find "{" as a module or policy.
> >>> default[424]: Failed to parse "{" entry.
> >>>
> >>> How could I resolve this?
> >>>
> >>> Thanks
> >>>
> >>>
> >>> Le sam. 16 avr. 2022 à 20:00, Matthew Newton <mcn at freeradius.org> a
> >> écrit :
> >>>
> >>>> On 16/04/2022 19:50, Bassem Mettichi wrote:
> >>>>> Thanks a lot Alan please could you give me an example for regexp that
> >>>> match
> >>>>> ipv4 and ipv
> >>>>
> >>>> https://duckduckgo.com/?q=regex+to+match+ip+address
> >>>>
> >>>> --
> >>>> Matthew
> >>>> -
> >>>> List info/subscribe/unsubscribe? See
> >>>> http://www.freeradius.org/list/users.html
> >>>>
> >>> -
> >>> List info/subscribe/unsubscribe? See
> >> http://www.freeradius.org/list/users.html
> >>
> >> -
> >> List info/subscribe/unsubscribe? See
> >> http://www.freeradius.org/list/users.html
> >>
> > -
> > List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>


More information about the Freeradius-Users mailing list