Hi!
   I use freeradius 0.5 with postgresql 7.2 on FreeBSD 4.5
When i run freeradius in dedug mode (radiusd -x), I found that:
1) freeradius query for Accounting stop packets with
"accounting_stop_query_alt" in any way, regardless of accounting_stop_query
fail or not

rad_recv: Accounting-Request packet from host x.x.x.x, id=206, length=127

query: UPDATE radacct SET AcctStopTime =.....
rlm_postgresql Status: PGRES_COMMAND_OK
sql_postgresql: affected rows = 1

query: INSERT into radacct ( AcctSessionId,....
rlm_postgresql Status: PGRES_FATAL_ERROR
sql_postgresql: affected rows =

I have not many C experience, but it seems like
sql_affected_rows always 0 for update query


rlm_sql.c:

numaffected = (inst->module->sql_affected_rows)(sqlsocket, inst->config);
if (numaffected < 1) {
        /*
         * If our update above didn't match anything
         * we assume it's because we haven't seen a
         * matching Start record.  So we have to
         * insert this stop rather than do an update
         */
...

2) accounting_stop_query_alt is syntacticaly incorrect (both sql.conf and
postgresql.conf).

rlm_postgresql Status: PGRES_FATAL_ERROR
sql_postgresql: affected rows =
rlm_sql: Couldn't insert SQL accounting STOP record - ERROR:  Bad timestamp
external representation '0'

accounting_stop_query_alt = "INSERT into radacct ( ...., AcctStartTime,....)
values (....., '0',...);

I fix this with (now()-interval '%{Acct-Session-Time}')


And now freeradius doubles acct_stop records in radacct table. First with
update (accounting_stop_query), and second with insert
(accounting_stop_query_alt)


Roman


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to