return a special value in reply when simultaneous use

Ana Gallardo ana.gallardo.77 at gmail.com
Fri Jul 23 12:59:02 CEST 2010


Hello again,

I'm working with Freeradius 2.1.8
>
> I'm using session (sql) to control simultaneous use.
>
> I would like to return a special value if an user try to access with
> credentials in use.
>

I have it working adding a new attribute to request list whit the result of
the simul_count_query, and checking this value later in post_auth section.

session {
        if ("%{Realm}" == "xxx.es") {
                update request {
                        Num-Open-Session := "%{sql:SELECT COUNT(*) FROM
radacct WHERE username = '%{SQL-User-Name}' AND acctstoptime IS NULL}"
                }
                sql
        }
}


post-auth {
        sql
        if (fail) {
                update reply {
                        Codigo-Reject := Imposible-Contactar-Backend
                }
                reject
        }
        Post-Auth-Type REJECT {
                if ("%{request:Num-Open-Session}"){
                        update reply {
                                Codigo-Reject = Sesion-Abierta
                        }
                }
                else{
                        update reply {
                                Codigo-Reject = Credenciales-Erroneas
                        }
                }
I think that this not is the better way to do, but...

Thank you very much

____________________

  Ana Gallardo Gómez
____________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20100723/8b51e649/attachment.html>


More information about the Freeradius-Users mailing list