On 7/5/05, Carlos MartÃnez-Troncoso Cera <cmartinez@uninorte.edu.co> wrote:
How are you testing? in the radacct table see if AcctSessionTime has some value, this is the data used for the counter, if this value is 0, the query is 0, you can test with NTRadPing sending in AcctSessionTime some value.
Well it has the values expected, > 0 for various for the users I'm testing with. I've also tested the queries outside radius directly in Postgres and I returns a number > 0, for example: SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='ceruno' AND AcctStartTime > abstime(1120539600). this query returns > 0 but when Radius does it, it apparently returns 0, I think there is a bug in someplace. (Did you read the last part of the email?) :
Looking at the code in rlm_sqlcounter.c in the sqlcounter_authorize function (the lines starting with * is what I've added).
/* third, wrap query with sql module & expand */ sprintf(querystr, "%%{%%S:%s}", responsestr); sqlcounter_expand(responsestr, MAX_QUERY_LEN, querystr, instance);
/* Finally, xlat resulting SQL query */ radius_xlat(querystr, MAX_QUERY_LEN, responsestr, request, NULL);
* DEBUG2("rlm_sqlcounter: querystr: %s",querystr); * DEBUG2("rlm_sqlcounter: responsestr: %s",responsestr); counter = atoi(querystr);
* DEBUG2("rlm_sqlcounter: Valor obtenido de la consulta: %d",counter); * DEBUG2("rlm_sqlcounter: Valor a checkar: %d",check_vp->lvalue);
If you compare the output above you will note that when 'counter = atoi(querystr)' happens the value of querystr is : ' %{%S:SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='ceruno' AND AcctStartTime > abstime(1120539600)}' . So I think is maybe a bug.
I also have a question: Where the SQL query really happens? I couldn't figure it out :(
I'am runnig in a FC3 with PostgreSQL 7.4.8 and the last stable release of freeRadius. (Version 1.0.4)
I'll appreciate any help you can give me.
Miguel.
Miguel. No sabia que usaran freeRadius por Curramba. :)