Hello, following test code: #include <libsmbclient.h> #include <locale.h> #include <stdio.h> void smb_auth(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen) { wglen = unlen = pwlen = 0; } int main(void) { setlocale(LC_ALL, ""); printf("locale = %s\n", setlocale(LC_MESSAGES, NULL)); smbc_init(smb_auth,0); //smbc_open("", O_RDONLY,0); printf("locale = %s\n", setlocale(LC_MESSAGES, NULL)); } In my system (SuSE 9.3), the output is: locale = de_DE.UTF-8 locale = C That can be problematic in locale-aware applications (for example it leads to a problem in libxine, if the smb-input-plugin is installed, etc.). I use version 3.0.13 shipped with SuSE 9.3. I even confirmed the bug on other systems running the same version.
Jeremy is the expert on locale issues. We discussed this at the CIFS conference. Apparently, some locale code was added a while back for something that vorlon required (some lower case letters don't match to their upper case equivalent in some European language, or something) and that code is suspect here.
Jeremy, this bug has been pending for a long time. We discussed it at the CIFS conference. When you get a chance, do you think you could look at it? Thanks. Derrell
This bug causes a no-ending pain for anyone using libsmbclient based libraries. For example, this would break all the xine front-ends when the smb input plugin is present, all the applications using gnome-vfs if smb is browsed, and most likely KDE apps that browse smb as well.
Yeah, I'm sure that this was the cause for Nautilus and GnomeVFS sometimes not being localized. It's really important for many clients - maybe you could raise the severity and milestone it?
source/lib/charcnv.c:charset_name seems to be the culprit. You should either use the method described under [1] to strdup and re-set the locale variable in your second setlocale call instead of using "C", or remove the setlocale calls altogether. I don't know why these were added, and the ChangeLog isn't verbose either. [1] http://www.delorie.com/gnu/docs/glibc/libc_112.html
Ok, I took a look at this. The problem is that smbd uses toupper/tolower expecting that these *must* be "C" locale conversions. Note this comment : /* We set back the locale to C to get ASCII-compatible toupper/lower functions. For now we do not need any other POSIX localisations anyway. When we should really need localized string functions one day we need to write our own ascii_tolower etc. */ The time has now come to write ascii_tolower/ascii_toupper and replace all calls to tolower()/toupper() with them - if you notice they are usually only called when we *know* the character being examined is in the ASCII char set. This will have to be done for 3.0.22. Please mark this as a show-stopper for 3.0.22. Once this is done we can replace the setlocale(LC_ALL, "C") call but not before. I'm assigning this one to me as I know the effect this will have on all the code code. Jeremy.
Check out SVN revision 12522 in SAMBA_3_0 or revision 12521 in HEAD to check out the fix I've added for this bug. Should be fixed as I've removed the setlocale call in lib/charcnv.c and modified all the toupper/tolower/isupper/islower calls to be _ascii versions. Please let me know if this fixes the problem. Jeremy.
Jeremy, there's been no response to this in a few months. Can we close it?
Yeah, this should be fixed in svn now. Closing. Jeremy.