RE: RE: access for 24 hours after first login?
>how is the actual comparision of the calculated value in "query" done, does >it >mean, that the value returned by "query" has to be smaller than the one >referred to by "check-name" (in your example Max-Secs-Passed)? It works quite simple If ( (Max-Secs-Passed - All-Secs-Passed > 0) => allow access >what does the line "sqlmod-inst = sql" mean (in >/usr/share/doc/freeradius/rlm_sqlcounter there is also the value "sqlcc3", >what >does this do?) It are the defined SQL instances in sql.conf >what about the following: > >SELECT TO_DAYS(NOW()) - TO_DAYS(AcctStartTime) from radacct WHERE UserName >= >'%(%k)' LIMIT 1; This query works but I don't use it because of the rounding it gives me... >would this mean that a user can login until 23:59 after logged in the first >time >that day? Yes, since he doesn't look at the hour/minutes/seconds... - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
RE: RE: access for 24 hours after first login?
>It doesn't work on postgresql v7.4.6 that I tried it on.. howver, I used > >"SELECT now() - AcctStartTime FROM radacct WHERE UserName = '%{%k}' >LIMIT 1;" > Be carefull with this! "SELECT now() - AcctStartTime Secs FROM radacct WHERE UserName = '%{k}' LIMIT 1;" Gives for example with username 'test': +---+ | Secs | +---+ | 684042112 | +---+ Recalculated in days: 7917,1540740740740740740740740741 days Is NOT the same as: "SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) Secs FROM radacct WHERE UserName = '%{%k}' LIMIT 1" Gives for example with username 'test': +--+ | Secs | +--+ | 17119330 | +--+ Recalculated in days: 198,14039351851851851851851851852 198days is the correct calculation... So as you can see, it isn't the same, at least in MySQL, don't know with other databases. So before you you begin: think, try and check your things. J. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html