Deleting stale session automatically with unlang

Eddie Stassen estassen at gmail.com
Fri Jan 14 13:34:41 CET 2011


On Fri, Jan 14, 2011 at 1:57 PM, Johan Meiring
<jmeiring at pcservices.co.za> wrote:
> On 2011/01/14 12:50 PM, Bishal Pun wrote:
>>
>> Alan,
>>
>>  While running that command in mysql it clear the session of user. But
>> with
>> radius unlang it is giving error in radius log.
>>
>
> I might be wrong, but as far as I know rlm_mysql expects something to come
> back from the query.
>
> Can't think of a solution though unless rlm_mysql will allow somehting like
>
> "%{sql: SELECT 1; UPDATE radacct set
> AcctStopTime=ADDDATE(AcctStartTime,INTERVAL
> AcctSessionTime SECOND), AcctTerminateCause='Clear-Stale Session' WHERE
> UserName='%{User-Name}' and CallingStationId='%{Calling-Station-Id}' and
> AcctStopTime is null}"
>
> --

Enclosing the UPDATE in an empty 'if' works:

if ("%{sql: UPDATE ...}") {
}

That prevents the rlm_sql_mysql module from looking for returned fields.

Eddie




More information about the Freeradius-Users mailing list