--- On Fri, 5/8/09, Ivan Kalik <tnt@kalik.net> wrote:
From: Ivan Kalik <tnt@kalik.net> Subject: Re: Another "package" - set expiry at first use To: "FreeRadius users mailing list" <freeradius-users@lists.freeradius.org> Date: Friday, May 8, 2009, 1:05 PM
Upon successful authentication, check it is firstuse. If yes, set expiry to say 6 months from now.
Use unlang in post-auth: check that there is no session for that user in radacct; if none, put adddate(now(),INTERVAL 6 MONTH) into Tmp-String-0; if you want to keep it in unlang (don't want to write a perl script) you need to convert that from mysql time (yyyy-MM-dd HH:mm:ss) to Month dd yyyy HH:mm:ss using mysql time functions (+ concat()) and store it in Tmp-String-1; then insert Tmp-String-1 as Expiration value for that user in radcheck.
On second thought, maybe we could implement an alternate scheme which is cheaper. At post-auth, check if a used_flag in the database exists. If not, create one ***AND*** set expiry date. We can't keep this in either radcheck or radreply ( can we ? ), meaning we need another auxilliary table for users, say userinfo table. Regards