The Samba-Bugzilla – Attachment 16 Details for
Bug 122
smbclient ignores Unix locale settings when choosing a charset
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add support for setlocale/nl_langinfo querying
samba-setlocale.diff (text/plain), 3.80 KB, created by
Steve Langasek
on 2003-05-25 19:12:11 UTC
(
hide
)
Description:
Patch to add support for setlocale/nl_langinfo querying
Filename:
MIME Type:
Creator:
Steve Langasek
Created:
2003-05-25 19:12:11 UTC
Size:
3.80 KB
patch
obsolete
>Index: source/configure.in >=================================================================== >RCS file: /cvsroot/samba/source/configure.in,v >retrieving revision 1.300.2.89 >diff -u -w -r1.300.2.89 configure.in >--- source/configure.in 23 May 2003 01:58:12 -0000 1.300.2.89 >+++ source/configure.in 24 May 2003 01:41:27 -0000 >@@ -528,6 +528,7 @@ > AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h) > AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h dlfcn.h) > AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h) >+AC_CHECK_HEADERS(langinfo.h locale.h) > > # In valgrind 1.0.x, it's just valgrind.h. In 1.9.x+ there's a > # subdirectory of headers. >@@ -842,6 +843,7 @@ > AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf) > AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink) > AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm) >+AC_CHECK_FUNCS(setlocale nl_langinfo) > # setbuffer, shmget, shm_open are needed for smbtorture > AC_CHECK_FUNCS(setbuffer shmget shm_open backtrace_symbols) > >Index: source/include/includes.h >=================================================================== >RCS file: /cvsroot/samba/source/include/includes.h,v >retrieving revision 1.262.2.38 >diff -u -w -r1.262.2.38 includes.h >--- source/include/includes.h 20 May 2003 18:30:37 -0000 1.262.2.38 >+++ source/include/includes.h 24 May 2003 01:41:28 -0000 >@@ -437,6 +437,14 @@ > #include <com_err.h> > #endif > >+#if HAVE_LOCALE_H >+#include <locale.h> >+#endif >+ >+#if HAVE_LANGINFO_H >+#include <langinfo.h> >+#endif >+ > /* Special macros that are no-ops except when run under Valgrind on > * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */ > #if HAVE_VALGRIND_MEMCHECK_H >Index: source/lib/charcnv.c >=================================================================== >RCS file: /cvsroot/samba/source/lib/charcnv.c,v >retrieving revision 1.55.2.22 >diff -u -w -r1.55.2.22 charcnv.c >--- source/lib/charcnv.c 8 May 2003 20:19:10 -0000 1.55.2.22 >+++ source/lib/charcnv.c 24 May 2003 01:41:28 -0000 >@@ -90,10 +90,28 @@ > if (!conv_handles[CH_UCS2][CH_UNIX]) > conv_handles[CH_UCS2][CH_UNIX] = smb_iconv_open("ASCII", "UCS-2LE"); > >+#ifdef HAVE_SETLOCALE >+ setlocale(LC_ALL, ""); >+#endif >+ > for (c1=0;c1<NUM_CHARSETS;c1++) { > for (c2=0;c2<NUM_CHARSETS;c2++) { > const char *n1 = charset_name((charset_t)c1); > const char *n2 = charset_name((charset_t)c2); >+#ifdef HAVE_NL_LANGINFO >+ const char *ln = nl_langinfo(CODESET); >+ >+ if (c1==CH_DISPLAY && conv_handles[c1][c2] && >+ strcmp(ln, conv_handles[c1][c2]->from_name) == 0 && >+ strcmp(n2, conv_handles[c1][c2]->to_name) == 0) >+ continue; >+ >+ if (c2==CH_DISPLAY && conv_handles[c1][c2] && >+ strcmp(n1, conv_handles[c1][c2]->from_name) == 0 && >+ strcmp(ln, conv_handles[c1][c2]->to_name) == 0) >+ continue; >+ >+#endif > if (conv_handles[c1][c2] && > strcmp(n1, conv_handles[c1][c2]->from_name) == 0 && > strcmp(n2, conv_handles[c1][c2]->to_name) == 0) >@@ -104,6 +122,25 @@ > if (conv_handles[c1][c2]) > smb_iconv_close(conv_handles[c1][c2]); > >+#ifdef HAVE_NL_LANGINFO >+ if (c1==CH_DISPLAY && c2==CH_DISPLAY) { >+ conv_handles[c1][c2] = smb_iconv_open(ln,ln); >+ if (conv_handles[c1][c2] != (smb_iconv_t)-1) { >+ continue; >+ } >+ } else if (c1==CH_DISPLAY) { >+ conv_handles[c1][c2] = smb_iconv_open(n2,ln); >+ if (conv_handles[c1][c2] != (smb_iconv_t)-1) { >+ continue; >+ } >+ } else if (c2==CH_DISPLAY) { >+ conv_handles[c1][c2] = smb_iconv_open(ln,n1); >+ if (conv_handles[c1][c2] != (smb_iconv_t)-1) { >+ continue; >+ } >+ } >+ /* Fall back to the configured charset. */ >+#endif > conv_handles[c1][c2] = smb_iconv_open(n2,n1); > if (conv_handles[c1][c2] == (smb_iconv_t)-1) { > DEBUG(0,("Conversion from %s to %s not supported\n",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 122
:
16
|
32
|
38