Skip to content

xml for mysql for radius for coovachilli because hibernates 2nd datasource was weak :(

when i tried to add another datasource to the hibernate environment i ran into problems (connection timed out)… i now use the xml way which i talk about earlier … well i didn’t want to install mysql 6 because its just in the alpha release. so i wrote this little cgi script. later when mysql 6 is stable I will use the LOAD XML function. This has the big benefit that i don’t have to open the 3306 … which was dirty but fast anyway.

the privileges: “insert, update, select, ALTER ROUTINE, CREATE ROUTINE, EXECUTE, File” are needed.

This script here can insert and update data in the tables via xml:

here is the format of the xml files for input:

<updates>
<update>
<field name=”UserName”>some new name</field>
<condition name=”id”>7</condition>
</update>
….
</updates>

<inserts>
<insert>
<field name=”UserName”>tttttttttttt</field>
<field name=”Value”>tttttt</field>

</insert>

</inserts>

for getting data this here is possible:

for getting the rows when somebody was online, put the parameters ‘actTime’ with the condition Value yyyy-mm-dd hh:mm and for the ‘type’ put the Value ‘getActionsInTime’, than you get something like this:

<?xml version="1.0"?>
<resultset>
<row>
<field>
<WlanUserActions>
<Action>
<AcctStartTime>2008-09-01 19:34:01</AcctStartTime>
<UserName>username</UserName>
<FramedIPAddress>10.1.0.114</FramedIPAddress>
<AcctTerminateCause>User-Request</AcctTerminateCause>
<AcctSessionTime>16731</AcctSessionTime>
<AcctStopTime>2008-09-02 00:12:52</AcctStopTime>
</Action>
....
</WlanUserActions >
</field>
</row>
</resultset>

i haven’t figured out how to get rid of the row and field tags…from a mysql command.
To get Rows from the radacct table for a specific user put ‘getActions’ as type and set the Value
for the parameter ‘UserName’.

BE WARNED THERE SOME HIGH SECURITY RISKS BY IMPLEMENTING THIS SCRIPT, I CAN NOT BE MADE RESPONSIBLE FOR ANYTHING HAPPENING BECAUSE OF THIS SCRIPT.

here

Categories: algorithms, linux, networking.

Tags: , , , , , , , , , , , ,

Comment Feed

One Response

  1. Hello, first of all im glad some one had the corage to write a excelent tutorial with all the steps, thanks for that.

    Second im having some major problems and i hope you can help-me, i tested the manual on a fresh ubuntu install and now i run in to some problems, althoug i managed to finish with success you tutorial/manual.

    If you can please contact-me to messenger using messenger@cesararaujo.net



Some HTML is OK

or, reply to this post via trackback.