permit access on date/hour intervals and policy.conf problem

Franz Angeli franz.angeli at gmail.com
Thu Jun 4 20:47:21 CEST 2015


and just for info...are there some other ways to obtain the same result?

2015-05-19 21:08 GMT+02:00 Franz Angeli <franz.angeli at gmail.com>:
> yes my is V 2.1.12
>
> with:
>
> policy {
> sql
> check_validity {
>      update control {
>        System-Date := "%l"
>      }
>      if ("%{control:Start_Time}" > "%{control:System-Date}") {
>        update reply {
>          Reply-Message := "account not yet active"
>        }
>        reject
>      }
>      if ("%{control:Stop_Time}" < "%{control:System-Date}") {
>        update reply {
>          Reply-Message := "account no longer active"
>        }
>        reject
>      }
>    }
>
> it works!
>
> ++- entering policy check_validity {...}
> expand: %l -> 1432062177
> +++[control] returns noop
> +++? if ("%{control:Start_Time}" > "%{control:System-Date}")
> expand: %{control:Start_Time} -> 1432062108
> expand: %{control:System-Date} -> 1432062177
> ? Evaluating ("%{control:Start_Time}" > "%{control:System-Date}") -> FALSE
> +++? if ("%{control:Start_Time}" > "%{control:System-Date}") -> FALSE
> +++? if ("%{control:Stop_Time}" < "%{control:System-Date}")
> expand: %{control:Stop_Time} -> 1432062308
> expand: %{control:System-Date} -> 1432062177
> ? Evaluating ("%{control:Stop_Time}" < "%{control:System-Date}") -> FALSE
> +++? if ("%{control:Stop_Time}" < "%{control:System-Date}") -> FALSE
> ++- policy check_validity returns noop
>
> or in case of Stop_Time < System-Date
>
> ++- entering policy check_validity {...}
> expand: %l -> 1432062346
> +++[control] returns noop
> +++? if ("%{control:Start_Time}" > "%{control:System-Date}")
> expand: %{control:Start_Time} -> 1432062108
> expand: %{control:System-Date} -> 1432062346
> ? Evaluating ("%{control:Start_Time}" > "%{control:System-Date}") -> FALSE
> +++? if ("%{control:Start_Time}" > "%{control:System-Date}") -> FALSE
> +++? if ("%{control:Stop_Time}" < "%{control:System-Date}")
> expand: %{control:Stop_Time} -> 1432062308
> expand: %{control:System-Date} -> 1432062346
> ? Evaluating ("%{control:Stop_Time}" < "%{control:System-Date}") -> TRUE
> +++? if ("%{control:Stop_Time}" < "%{control:System-Date}") -> TRUE
> +++- entering if ("%{control:Stop_Time}" < "%{control:System-Date}") {...}
> ++++[reply] returns noop
> ++++[reject] returns reject
>
> Thanks!!!
>
> 2015-05-19 20:51 GMT+02:00 Alan DeKok <aland at deployingradius.com>:
>> On May 19, 2015, at 2:50 PM, Franz Angeli <franz.angeli at gmail.com> wrote:
>>
>>> with attribute set at integer i have:
>>>
>>> ++- entering policy check_validity {...}
>>> expand: %l -> 1432061274
>>> +++[control] returns noop
>>> +++? if (control:Start_Time > control:System-Date)
>>> Failed parsing "control:System-Date": Unknown value
>>
>>   In v2, you have to do:
>>
>>         if (control:Start_Time > "%{control:System-Date}") {
>>                 ...
>>
>>   In v3, you can compare attributes directly.
>>
>>   Alan DeKok.
>>
>> -
>> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list