rlm_sql_mysql UTF-8 encoding
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Tue Oct 4 15:50:52 CEST 2011
>
> however as it gets to the rlm_sql_mysql module it shows
> # [sql] expand: %{User-Name} -> g.?up.wór
> # [sql] sql_set_user escaped user --> 'g.?up.wór'
>
> It does seem that the UserName string is iterated byte by byte and not UTF-8 aware way.
>
> hence it shows:
>
> # [sql] expand: SELECT id, username, attribute, value, op FROM # radcheck WHERE username = '%{SQL-User-Name}' ORDER # BY id -> SELECT id, username, attribute, value, op FROM # radcheck WHERE username = 'g=C5=82up.w=C3=B3r' ORDER BY id
> # rlm_sql_mysql: query: SELECT id, username, attribute, value, op # FROM radcheck WHERE username = 'g=C5=82up.w=C3=B3r' # ORDER BY id
> # [sql] expand: SELECT groupname FROM radusergroup # WHERE username = '%{SQL-User-Name}' ORDER BY priority -> # SELECT groupname FROM radusergroup WHERE username = # 'g=C5=82up.w=C3=B3r' ORDER BY priority
> # rlm_sql_mysql: query: SELECT groupname FROM radusergroup # WHERE username = 'g=C5=82up.w=C3=B3r' ORDER BY priority
>
>
> the username is encoded as
> g=C5=82up.w=C3=B3r
> both UTF-8 encoded characters (=C5=82, =C3=B3) were treated as separate characters (=C5, =82, =C3, =B3).
>
> I found sth about the problem I am facing:
> http://freeradius.1045715.n5.nabble.com/rlm-sql-and-UTF8-encoded-strings-td2794683.html
>
The problem is the safe chars check is not UTF8 capable, so it's looking at each byte of the User-Name string, comparing it to the list of safe chars, finding it doesn't match and mime encoding it.
Patches welcome.
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Betelwiki, Betelwiki, Betelwiki.... http://wiki.freeradius.org/ !
More information about the Freeradius-Users
mailing list