Bug#7519: setlocale() considered harmful in library functions

sean finney seanius at seanius.net
Thu Feb 3 06:06:58 MST 2011


Hi everyone,

For those not familiar with the background:

https://bugzilla.samba.org/show_bug.cgi?id=7519

Basically, there are functions now part of samba libraries linked
by other applications in which there are calls to setlocale(LC_ALL,
"C"), and worse, no corresponding calls to return the locale to it's
original setting.

This breaks a lot of translation and charset related stuff any app
that links directly or indirectly with such a library (libsamba-util,
i believe).

For example, the Evolution mail program, when using the MAPI plugin (which
links against openchange libraries, which in turn links to samba), will
send a jumble of asian and wingding looking fonts instead of $importantmail
for anything with non-ascii characters in it.

In the above bug discussion, it was intimated that we need to commonize or
have a parallel implementation between s3/s4 of toupper/tolower, which is
the only reason behind needing setlocale() in the first place.  The bug
in question ends at this point with "this type of stuff should be brought
up on the mailing list", so... here it is, please discuss :)

If it's a matter of time/interest, I have both as it's a bit of a blocker
on my current project, although I'm not intimate with the samba internals
and might need a bit of direction for what specifically needs to be done.
Otherwise I'm also happy to test any changes as they pertain to client
apps (but have no s4 server environment to test otherwise).


Best regards!
	Sean


More information about the samba-technical mailing list