--- /dev/null
+Index: SAMBA_3_0/source/lib/util_unistr.c
+===================================================================
+--- SAMBA_3_0/source/lib/util_unistr.c (revision 12521)
++++ SAMBA_3_0/source/lib/util_unistr.c (revision 12522)
+@@ -51,6 +51,7 @@
+ void load_case_tables(void)
+ {
+ static int initialised;
++ char *old_locale = NULL, *saved_locale = NULL;
+ int i;
+
+ if (initialised) {
+@@ -61,6 +62,17 @@
+ upcase_table = map_file(data_path("upcase.dat"), 0x20000);
+ lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
+
++#ifdef HAVE_SETLOCALE
++ /* Get the name of the current locale. */
++ old_locale = setlocale(LC_ALL, NULL);
++
++ /* Save it as it is in static storage. */
++ saved_locale = SMB_STRDUP(old_locale);
++
++ /* We set back the locale to C to get ASCII-compatible toupper/lower functions. */
++ setlocale(LC_ALL, "C");
++#endif
++
+ /* we would like Samba to limp along even if these tables are
+ not available */
+ if (!upcase_table) {
+@@ -92,6 +104,12 @@
+ lowcase_table[v] = UCS2_CHAR(isupper(i)?tolower(i):i);
+ }
+ }
++
++#ifdef HAVE_SETLOCALE
++ /* Restore the old locale. */
++ setlocale (LC_ALL, saved_locale);
++ SAFE_FREE(saved_locale);
++#endif
+ }
+
+ /*
+@@ -997,3 +1015,41 @@
+
+ return dst;
+ }
++
++/*************************************************************
++ ascii only toupper - saves the need for smbd to be in C locale.
++*************************************************************/
++
++int toupper_ascii(int c)
++{
++ smb_ucs2_t uc = toupper_w(UCS2_CHAR(c));
++ return UCS2_TO_CHAR(uc);
++}
++
++/*************************************************************
++ ascii only tolower - saves the need for smbd to be in C locale.
++*************************************************************/
++
++int tolower_ascii(int c)
++{
++ smb_ucs2_t uc = tolower_w(UCS2_CHAR(c));
++ return UCS2_TO_CHAR(uc);
++}
++
++/*************************************************************
++ ascii only isupper - saves the need for smbd to be in C locale.
++*************************************************************/
++
++int isupper_ascii(int c)
++{
++ return isupper_w(UCS2_CHAR(c));
++}
++
++/*************************************************************
++ ascii only islower - saves the need for smbd to be in C locale.
++*************************************************************/
++
++int islower_ascii(int c)
++{
++ return islower_w(UCS2_CHAR(c));
++}
+Index: SAMBA_3_0/source/lib/charcnv.c
+===================================================================
+--- SAMBA_3_0/source/lib/charcnv.c (revision 12521)
++++ SAMBA_3_0/source/lib/charcnv.c (revision 12522)
+@@ -84,15 +84,6 @@
+ }
+ ret = ln;
+ }
+-#ifdef HAVE_SETLOCALE
+- /* 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.
+- */
+- setlocale(LC_ALL, "C");
+- #endif
+-
+ #endif
+
+ if (!ret || !*ret) ret = "ASCII";
+Desc: Back out changes made to 3_0_RELEASE branch that disabled the above hacks
+===============================================================================
+--- SAMBA_3_0/source/include/smb_macros.h 2006-01-25 10:46:39.000000000 +1100
++++ SAMBA_3_0/source/include/smb_macros.h 2006-04-10 21:16:13.000000000 +1000
+@@ -24,14 +24,6 @@
+ #ifndef _SMB_MACROS_H
+ #define _SMB_MACROS_H
+
+-/* no ops to help reduce the diff between the current 3.0 and release branch */
+-
+-#define toupper_ascii(x) toupper(x)
+-#define tolower_ascii(x) tolower(x)
+-#define isupper_ascii(x) isupper(x)
+-#define islower_ascii(x) islower(x)
+-
+-
+ /* Misc bit macros */
+ #define BOOLSTR(b) ((b) ? "Yes" : "No")
+ #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)