How to get current datetime in freeradius?
Christian Strauf
strauf at rz.tu-clausthal.de
Wed Oct 2 08:38:09 CEST 2019
Hi Houman
> I'm still unable to get the local timestamp. Do I have to enable anything
> else?
If you need the local time multiple times (or did I misunderstand you?), try something like this:
update control {
&Tmp-Integer-0 := "%l"
}
Use this in your configuration (note that I made some modifications to "Expires-At":
preacct {
update control {
&Tmp-Integer-0 := "%l"
}
update request {
&Expires-At := "%{sql:SELECT expires_at FROM main_db.`user` WHERE main_db.`user`.username ='%{User-Name}'}"
}
if (&control:Tmp-Integer-0 > &request:Expires-At) {
update disconnect {
&User-Name = "%{User-Name}"
}
}
...
}
If you don't need the time multiple times, you should be able to use "%l" instead of &control:Tmp-Integer-0. Also note that you need to use some other Tmp-Integer-0 if you already use that pre-defined control variable.
Kind regards,
Christian Strauf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5279 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20191002/94486562/attachment.bin>
More information about the Freeradius-Users
mailing list