select 123456 from radacct where username = 'mauro' LIMIT 1

On Wed, May 20, 2009 at 2:44 PM, Mauro Iorio - Smart Soft s.r.l. <m.iorio@smartsoft.it> wrote:
>
>   What happens when you replace that SELECT statement with a hard-coded
> number, like 123456?  Does it still truncate the result?
>
>   Alan DeKok.
>

Yes, it does. Check the following output:

-----------------------------------------

rlm_sqlcounter: Entering module authorize code
sqlcounter_expand:  'SELECT 123456 FROM radacct WHERE
UserName='%{User-Name}''
[sessioncounter]        expand: SELECT 123456 FROM radacct WHERE
UserName='%{Use
r-Name}' -> SELECT 123456 FROM radacct WHERE UserName='mauro'
sqlcounter_expand:  '%{sql:SELECT 123456 FROM radacct WHERE
UserName='mauro'}'
[sessioncounter] sql_xlat
[sessioncounter]        expand: %{User-Name} -> mauro
[sessioncounter] sql_set_user escaped user --> 'mauro'
[sessioncounter]        expand: SELECT 123456 FROM radacct WHERE
UserName='mauro
' -> SELECT 123456 FROM radacct WHERE UserName='mauro'
[sessioncounter]        expand: /usr/var/log/radius/sqltrace.sql ->
/usr/var/log
/radius/sqltrace.sql
rlm_sql (sql): Reserving sql socket id: 3
query:  SELECT 123456 FROM radacct WHERE UserName='mauro'
[sessioncounter] sql_xlat finished
rlm_sql (sql): Released sql socket id: 3
[sessioncounter]        expand: %{sql:SELECT 123456 FROM radacct WHERE
UserName=
'mauro'} -> 1234
rlm_sqlcounter: Check item is greater than query result
rlm_sqlcounter: Authorized user mauro, check_item=3600, counter=1234
rlm_sqlcounter: Sent Reply-Item for user mauro, Type=Session-Timeout,
value=2366
++[sessioncounter] returns ok
WARNING: Please update your configuration, and remove 'Auth-Type = Local'
WARNING: Use the PAP or CHAP modules instead.
User-Password in the request is correct.
+- entering group post-auth {...}
++[exec] returns noop
Sending Access-Accept of id 213 to 192.168.4.203 port 44967
       Session-Timeout = 2366
Finished request 0.

-----------------------------------------

But when I use isql or tsql tools and runs the same query I get (since I
have 12 records in radacct):

SQL> select 123456 from radacct where username = 'mauro'
+------------+
|            |
+------------+
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
| 123456     |
+------------+
SQLRowCount returns 12
12 rows fetched

So I think everything about unixodbc drivers is working properly.

Mauro Iorio.

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