questions regarding sql xlat

Arran Cudbard-Bell A.Cudbard-Bell at sussex.ac.uk
Mon Apr 20 12:46:51 CEST 2009


On 20/4/09 09:34, Uwe Kastens wrote:
> Arran,
>
>
>>> If I try to use sql xlat I will get the answer:
>>> Error: rlm_sql: Failed to create the pair: Unknown value %{sql:SELECT
>>> disctime.time FROM `disctime` WHERE disctime.user = %{User-Name}}   for
>>> attribute Session-Timeout
>>> Sun Apr 19 20:11:03 2009 : Error: rlm_sql (sql): Error getting data from
>>> database
>>> I tried several different things: Use a select statement to query the
>>> integer directly. I ends up in the same error. I am using:
>> *sigh* single quotation marks around %{User-Name}, it's still a string
>> remember....
>
> So this should work? ATM I am nearly sure that this could never work,
> since the 1st query will deliver the string, that rlm_sql should expand
> with another query.
>
> But it would be great if it will work :-)

rlm_sql does recursive xlat, all xlat expansions in the SQL query are 
done before the query string is passed off to the SQL libraries. The 
xlat parser is just looking for a string bounded by %{ }.

Your query should be:
%{sql:SELECT disctime.time FROM `disctime` WHERE disctime.user = 
'%{User-Name}'}

It's not a problem in FreeRADIUS it's a problem in your SQL syntax :)

Arran

-- 
Arran Cudbard-Bell (A.Cudbard-Bell at sussex.ac.uk),
Authentication, Authorisation and Accounting Officer,
Infrastructure Services (IT Services),
E1-1-08, Engineering 1, University Of Sussex, Brighton, BN1 9QT
DDI+FAX: +44 1273 873900 | INT: 3900
GPG: 86FF A285 1AA1 EE40 D228 7C2E 71A9 25BB 1E68 54A2



More information about the Freeradius-Users mailing list