Deleting stale session automatically with unlang

Bishal Pun bishalpun at gmail.com
Sat Jan 15 03:02:21 CET 2011


Hello Edi,
 Enclosing sql statement inside empty if gives same error:

if(User-Name){
        if("%{sql: 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}"){
        }
}
Sat Jan 15 07:43:33 2011 : Auth: Login OK: [test] (from client nagios port
0)
Sat Jan 15 07:44:47 2011 : Error: rlm_sql_mysql: MYSQL Error: No Fields
Sat Jan 15 07:44:47 2011 : Error: rlm_sql_mysql: MYSQL error:
Sat Jan 15 07:44:47 2011 : Info: rlm_sql_mysql: Starting connect to MySQL
server for #3
Sat Jan 15 07:44:47 2011 : Error: rlm_sql (sql): failed after re-connect


On Fri, Jan 14, 2011 at 6:19 PM, Eddie Stassen <estassen at gmail.com> wrote:

> 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
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20110115/e6f44002/attachment.html>


More information about the Freeradius-Users mailing list