expr in SQL not working

Alan DeKok aland at ox.org
Tue Oct 4 17:45:20 CEST 2005


"Gunther" <freeradius at caribsms.com> wrote:
> Tue Oct  4 00:53:46 2005 : Debug: rlm_sql_mysql: query:  SELECT
> phs_radgroupreply.radgroupreply_id,phs_radgroupreply.radgroupreply_groupname
> ,phs_radgroupreply.radgroupreply_attribute,phs_radgroupreply.radgroupreply_v
> alue,phs_radgroupreply.radgroupreply_op  FROM
> phs_radgroupreply,phs_usergroup WHERE phs_usergroup.usergroup_username =
> 'gunther' AND phs_usergroup.usergroup_groupname =
> phs_radgroupreply.radgroupreply_groupname ORDER BY
> phs_radgroupreply.radgroupreply_id
> Tue Oct  4 00:53:46 2005 : Debug: radius_xlat:  '='

  That last line doesn't look right.

> Tue Oct  4 01:00:33 2005 : Debug: radius_xlat: Running registered xlat
> function of module expr for string ' %{sql:SELECT IF(NOW() <= user_stoptime,
> TIME_TO_SEC(TIMEDIFF(user_stoptime, IF(NOW() >= user_starttime, now(),
> DATE_SUB(user_stoptime, INTERVAL 1 SECOND)))), 1) FROM phs_user WHERE
> user_username='%{User-Name}'}'

  The *only* text in that string is the SQL query.  There isn't any
additional math in it.  If the string *passed* to 'expr' contains the
math and this string doesn't, that looks like a bug.

> Tue Oct  4 01:00:33 2005 : Debug: rlm_sql (sql): Released sql socket id: 1
> Tue Oct  4 01:00:33 2005 : Debug: radius_xlat:  ' 601167'
> Tue Oct  4 01:00:33 2005 : Debug: radius_xlat:  '601167'

  The SQL query is running OK, but no math is being done because no
math was in the input string.

  It looks like the radius_xlat code needs more debugging output.

  I'm not sure what to suggest at this time, other than source code
mods to try to track down what's going on.

  Alan DeKok.



More information about the Freeradius-Users mailing list