Using unlang / SQL with single return value; couple of questions.

Alan DeKok aland at
Thu Apr 26 21:27:50 CEST 2018

On Apr 26, 2018, at 10:31 AM, Dom Latter <freeradius-users at> wrote:
> First thanks to Alan for pointing me in the right direction.

  You're welcome.

> 1st question: I am currently using a REGEXP in the query to perform a
> partial match and would prefer to use a LIKE '%foo%' instead... but the
> % wildcard seems to conflict with freeradius's own substitution.
> Anybody know a workaround?

  Use %%.  That gets converted to a bare % when passed to SQL.

> 2nd question: we use a "magic" MAC address for non-wifi authentication;
> which contains for no good reason, an exclamation mark.  The problem
> is that in the query the '%{request:Calling-Station-Id} gets expanded
> such that the '!' becomes '=21'.  So my WHEN clause in the SELECT has
> to match on '=21'.  Any workarounds so that the SQL query would see
> the "real" value?

  Not really.  "!" is a special character for SQL, and will get escaped by FreeRADIUS.

  Alan DeKok.

More information about the Freeradius-Users mailing list