Problem with expansion of %{Ldap-UserDn} containing UTF-8 (cf. Bug #411)

Alan DeKok aland at
Mon Aug 27 15:14:01 CEST 2007

Enrik Berkhan wrote:
> The idea would be: try iconv("UTF-8" -> "UTF-8"), escape if that fails.

  And escape what, the whole string?

  It's probably easier just to sanitize the string ourselves, because
iconv() may not be available on all platforms.

> Is there anonther good portable or even standard way of doing this?
> Clear disadvantage of iconv() is the non-thread-awareness of the state
> storage, so it should either be re-allocated on every usage (not cheap,
> I suppose) or be allocated in thread-local-storage somehow.

  Bleah.  There's no need to use a function with local non-thread-aware
storage.  It's easy to know what a valid UTF-8 character is.  We should
just check ourselves, and escape anything that isn't valid.

  Alan DeKok.

More information about the Freeradius-Devel mailing list