3.0.x rlm_sql mime encoding UTF8 characters

Phil Mayers p.mayers at imperial.ac.uk
Mon Oct 27 15:51:43 CET 2014


On 27/10/14 14:31, Adam Hammond wrote:

> Is there a way for me to get rlm_sql to accept UTF8 characters? Or
> even ignore that check (at my own risk)?

I suspect the problem is that rlm_sql safe_characters check treats the 
input and safe string as 1-octet wide strings. UTF8 is, of course, 
multibyte.

So, passing:

safe_characters = "£"

...is actually passing

safe_characters = "\xC2\xA3"

...and will be interpreted as such, a 2-char string. Likewise, a radius 
value containing that will search safe_characters for \xC2 then \xA3 as 
separate characters.

I'm kind of surprised it hasn't worked given the above, but I don't know 
what strchr() does with utf8 input to the "s" argument, and I suspect 
it's locale-dependent.

Rather than fix safe_characters, there should be a way to per-instance 
escape using functions like PQescapeLiteral and PQescapeStringConn, not 
something hardcoded into FreeRADIUS. I had patches to to this, but they 
bit-rotted.


More information about the Freeradius-Users mailing list