Unlang comparing variable correctly
ktm at rice.edu
ktm at rice.edu
Fri May 3 17:18:10 CEST 2013
On Fri, May 03, 2013 at 05:03:41PM +0200, Tyller D wrote:
> Hi,
>
> I am trying to compare a variable in freeradius using unlang but it seems
> to not be working correctly, more than likely i've made a mistake but let
> me show you.
>
> ? Evaluating (control:IMS-ActiveDirectory == 0) -> FALSE
> ++? if (control:IMS-ActiveDirectory == 0) -> FALSE
> ++? if (control:IMS-Timeout < 0)
> ? Evaluating (control:IMS-Timeout < 0) -> FALSE
> ++? if (control:IMS-Timeout < 0) -> FALSE
> ++? elsif (control:IMS-Timeout > 0)
> ? Evaluating (control:IMS-Timeout > 0) -> FALSE
> ++? elsif (control:IMS-Timeout > 0) -> FALSE
> ++? if (control:IMS-Data < 0)
> ? Evaluating (control:IMS-Data < 0) -> TRUE
> ++? if (control:IMS-Data < 0) -> TRUE
> ++- entering if (control:IMS-Data < 0) {...}
> expand: %{control:IMS-Data} Voucher Depleated -> 3221197824 Voucher
> Depleated
> +++[reply] returns noop
> +++[reject] returns reject
>
>
> So as you can see it enters entering if (control:IMS-Data < 0) {...}, as it
> says that IMS-Data is < 0. Its not, so I echoed out the variable in the
> next line and its value is 3221197824...
>
> The strange thing is if the variable is equal to 2147465216 then it does
> not enter that function.
>
> Why?
The value is stored in 4 bytes/signed. Values greater than (2**31)-1 and
less than (2**32) are negative, i.e. 3221197824.
Cheers,
Ken
More information about the Freeradius-Users
mailing list