unlang time / date comparison
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Wed Sep 19 11:54:50 CEST 2012
On 19 Sep 2012, at 08:50, Franks Andy (RLZ) IT Systems Engineer <Andy.Franks at sath.nhs.uk> wrote:
> Thanks Arran,
> I'll give it a try. I did find something to do with %1 / %I (can't
> remember which)
%1expands to the first regexp match, %l should expand to a UNIX timestamp.
You'll be looking for something like:
if ("%{sql:SELECT UNIX_TIMESTAMP(<my field>) FROM <my table> WHERE 1}" < "%{l}") {
}
FR will always try and do the right thing when it comes to comparing string values, and will automatically call atoi for you, and perform integer comparisons, but i'm not sure with a string to integer comparison, it'll try and parse the string as a date, hence suggesting you make it easier for the server by pulling it out as an integer.
What'd be neat is if the one letter expansions were converted to actual attributes, then we could use their type as a hint as to how the comparison should be performed.
-Arran
More information about the Freeradius-Users
mailing list