The Samba-Bugzilla – Attachment 32 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]
Updated patch
samba-setlocale.diff (text/plain), 3.62 KB, created by
Steve Langasek
on 2003-06-21 10:31:59 UTC
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Steve Langasek
Created:
2003-06-21 10:31:59 UTC
Size:
3.62 KB
patch
obsolete
>Index: source/configure.in >=================================================================== >RCS file: /cvsroot/samba/source/configure.in,v >retrieving revision 1.300.2.103 >diff -u -r1.300.2.103 configure.in >--- source/configure.in 20 Jun 2003 06:41:56 -0000 1.300.2.103 >+++ source/configure.in 21 Jun 2003 03:27:03 -0000 >@@ -529,6 +529,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. >@@ -843,6 +844,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.44 >diff -u -r1.262.2.44 includes.h >--- source/include/includes.h 16 Jun 2003 02:22:44 -0000 1.262.2.44 >+++ source/include/includes.h 21 Jun 2003 03:27:06 -0000 >@@ -439,6 +439,14 @@ > > #if HAVE_ATTR_XATTR_H > #include <attr/xattr.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 >Index: source/lib/charcnv.c >=================================================================== >RCS file: /cvsroot/samba/source/lib/charcnv.c,v >retrieving revision 1.55.2.26 >diff -u -r1.55.2.26 charcnv.c >--- source/lib/charcnv.c 16 Jun 2003 02:22:52 -0000 1.55.2.26 >+++ source/lib/charcnv.c 21 Jun 2003 03:27:07 -0000 >@@ -55,6 +55,30 @@ > else if (ch == CH_DISPLAY) ret = lp_display_charset(); > else if (ch == CH_UTF8) ret = "UTF8"; > >+#if defined(HAVE_NL_LANGINFO) && defined(CODESET) >+ if (ret && strcasecmp(ret, "LOCALE") == 0) { >+ const char *ln = NULL; >+ >+#ifdef HAVE_SETLOCALE >+ setlocale(LC_ALL, ""); >+#endif >+ ln = nl_langinfo(CODESET); >+ if (ln) { >+ /* Check whether the charset name is supported >+ by iconv */ >+ smb_iconv_t handle = smb_iconv_open(ln,"UCS-2LE"); >+ if (handle == (smb_iconv_t) -1) { >+ DEBUG(5,("Locale charset '%s' unsupported, using ASCII instead\n", ln)); >+ ln = NULL; >+ } else { >+ DEBUG(5,("Substituting charset '%s' for LOCALE\n", ln)); >+ smb_iconv_close(handle); >+ } >+ } >+ ret = ln; >+ } >+#endif >+ > if (!ret || !*ret) ret = "ASCII"; > return ret; > } >Index: source/param/loadparm.c >=================================================================== >RCS file: /cvsroot/samba/source/param/loadparm.c,v >retrieving revision 1.397.2.67 >diff -u -r1.397.2.67 loadparm.c >--- source/param/loadparm.c 20 Jun 2003 01:42:13 -0000 1.397.2.67 >+++ source/param/loadparm.c 21 Jun 2003 03:27:23 -0000 >@@ -1283,8 +1283,13 @@ > /* using UTF8 by default allows us to support all chars */ > string_set(&Globals.unix_charset, "UTF8"); > >- /* using UTF8 by default allows us to support all chars */ >+#if defined(HAVE_NL_LANGINFO) && defined(CODESET) >+ /* If the system supports nl_langinfo(), try to grab the value >+ from the user's locale */ >+ string_set(&Globals.display_charset, "LOCALE"); >+#else > string_set(&Globals.display_charset, "ASCII"); >+#endif > > /* Use codepage 850 as a default for the dos character set */ > string_set(&Globals.dos_charset, "CP850");
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