<div dir="ltr"><div>Hey,</div><div><br></div><div>In my FR1.1.7 setup, I have different realms for the same machine using different databases for each.</div><div>The login part is ok, as well as the accounting, which has entries in the radacct table for "account".</div>
<div><br></div><div>I enabled one of the sql counters modules which, as it seems, isn't returning any results, because I am</div><div>suspecting that it's running the query on another realm's database. I have several of the sql.conf config</div>
<div>files for each realm, so what I'm basically doing is having in accounting {} section something like this:</div><div><div>   Acct-Type SQL_EXAMPLE {</div><div>    sql_example</div><div>   }</div><div><br></div><div>
What do you think is happening?</div><div>Here is the relevant debug snippet from freeradius:</div><div><br></div><div><div>Wed May  6 22:47:28 2009 : Debug:   modsingle[authorize]: calling accessperiod (rlm_sqlcounter) for request 0</div>
<div>Wed May  6 22:47:28 2009 : Debug: rlm_sqlcounter: Entering module authorize code</div><div>Wed May  6 22:47:28 2009 : Debug: sqlcounter_expand:  'SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) FROM radacct WHERE UserName = '%{Stripped-User-Name:-%{User-Name}}' ORDER BY AcctStartTime LIMIT 1'</div>
<div>Wed May  6 22:47:28 2009 : Debug: radius_xlat:  'SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) FROM radacct WHERE UserName = 'access1' ORDER BY AcctStartTime LIMIT 1'</div><div>Wed May  6 22:47:28 2009 : Debug: sqlcounter_expand:  '%{sql:SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) FROM radacct WHERE UserName = 'access1' ORDER BY AcctStartTime LIMIT 1}'</div>
<div>Wed May  6 22:47:28 2009 : Debug: radius_xlat: Running registered xlat function of module sql for string 'SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) FROM radacct WHERE UserName = 'access1' ORDER BY AcctStartTime LIMIT 1'</div>
<div>Wed May  6 22:47:28 2009 : Debug: rlm_sql (sql): - sql_xlat</div><div>Wed May  6 22:47:28 2009 : Debug: radius_xlat:  'access1'</div><div>Wed May  6 22:47:28 2009 : Debug: rlm_sql (sql): sql_set_user escaped user --> 'access1'</div>
<div>Wed May  6 22:47:28 2009 : Debug: radius_xlat:  'SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) FROM radacct WHERE UserName = 'access1' ORDER BY AcctStartTime LIMIT 1'</div><div>Wed May  6 22:47:28 2009 : Debug: rlm_sql (sql): Reserving sql socket id: 2</div>
<div>Wed May  6 22:47:28 2009 : Debug: rlm_sql (sql): SQL query did not return any results</div><div>Wed May  6 22:47:28 2009 : Debug: rlm_sql (sql): Released sql socket id: 2</div><div>Wed May  6 22:47:28 2009 : Debug: radius_xlat:  ''</div>
<div>Wed May  6 22:47:28 2009 : Debug: rlm_sqlcounter: (Check item - counter) is greater than zero</div><div>Wed May  6 22:47:28 2009 : Debug: rlm_sqlcounter: Authorized user access1, check_item=300, counter=0</div><div>Wed May  6 22:47:28 2009 : Debug: rlm_sqlcounter: Sent Reply-Item for user access1, Type=Session-Timeout, value=300</div>
<div>Wed May  6 22:47:28 2009 : Debug:   modsingle[authorize]: returned from accessperiod (rlm_sqlcounter) for request 0</div><div>Wed May  6 22:47:28 2009 : Debug:   modcall[authorize]: module "accessperiod" returns ok for request 0</div>
<div><br></div></div><div><br></div><div><br></div></div>
<div><br></div><div><br></div><div><br></div><div><br></div><div>Regards,</div><div>Liran.</div></div>