[RADIATOR] Radiator's database handle

Michael ringo at vianet.ca
Thu Feb 16 08:32:47 CST 2012


I hate to answer a question with another question, but what, why and/or when are you writing data to the sql?  I write data to sql but I do it through any combination of <AuthBy SQL> <AuthLog SQL>, and sometimes an AuthBy SessionDB.  Works much better for me.  I try to avoid custom hooks if at all possible.  The ability for hooks is great to have, but if Radiator can already do a task just through config, i try to do it that way instead of a hook.

So, if you want to write something to a table for example ever time a user authenticates, use an <AuthBy AuthLog>, a SuccessQuery, and "LogSuccess      1".
if you want to write something when stop packets come in, use <AuthBy SQL>, with "HandleAcctStatusTypes   Stop", and a AcctSQLStatement.

depends on what you need to do.


On 12-02-16 09:17 AM, Alby wrote:
> Hi all,
> I'm using radiator with a SQL database that stores the users' data. I've also a PostAuthHook that writes some data on the SQL database. Up to now my Hook connects to the database, writes the data and then disconnects. I suspect that connecting and disconnecting each time I write to the database is not a really good idea (expecially for the performance). I've noticed that Radiator opens the connection to the database only the first time, then reuses it (this is of course a better way than mine). Since the database that I write is the same that I use on Radiator (same name, same user and same password), is there a way to reuse the Radiator's DB handle instead of creating a new one and destroying it each time?
> At at first glance, my idea was to open the database connection with a StartUpHook and then close with a ShutdownHook, but there is the problem on how to share the DB handle between the three Hooks. This should be made securely, because if an attacker is able to obtain the handler, it will be able to read and write the database without performing authentication first, I think. In my opinion reusing the Radiator DB handle is the best solution if it can be implemented.
> Thank you very much in advance for your help and for your attention
> Alberto
>
>
> _______________________________________________
> radiator mailing list
> radiator at open.com.au
> http://www.open.com.au/mailman/listinfo/radiator


More information about the radiator mailing list