summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2004-03-16 17:18:57 +0000
committerAlexander Bokovoy <ab@samba.org>2004-03-16 17:18:57 +0000
commite2fd98af575a5c240593f21df442eb035f35e892 (patch)
tree47cd4d75d440d48a79863113060ebdf3bb3e3a38 /source3/lib
parentdbb38cc6b5829d9ac45e3dea40878039edd26f8d (diff)
downloadsamba-e2fd98af575a5c240593f21df442eb035f35e892.tar.gz
samba-e2fd98af575a5c240593f21df442eb035f35e892.tar.bz2
samba-e2fd98af575a5c240593f21df442eb035f35e892.zip
Fix check_path_syntax() for multibyte encodings which have no '\' as second byte.
This is intermediate fix as discussed with Jeremy until we move check_path_syntax() to UCS2 internally where all ambiguity is resolved. Please add other encodings into charcnv.c with such property.' ' (This used to be commit 2c404f6ba988d68c6f44df9409c0de319553de10)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 20af806d90..b06d869bcc 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -41,6 +41,15 @@
static smb_iconv_t conv_handles[NUM_CHARSETS][NUM_CHARSETS];
static BOOL conv_silent; /* Should we do a debug if the conversion fails ? */
+/* Unsafe unix charsets which could contain '\\' as second byte of mb character */
+static const char *conv_unsafe_charsets[] = {
+ "CP932",
+ "EUC-JP",
+ NULL};
+/* Global variable which is set to True in init_iconv() if unix charset is unsafe
+ w.r.t. '\\' in second byte of mb character. Otherwise it is set to False.
+*/
+BOOL is_unix_charset_unsafe;
/**
* Return the name of a charset to give to iconv().
@@ -105,6 +114,7 @@ void init_iconv(void)
{
int c1, c2;
BOOL did_reload = False;
+ const char **unsafe_charset = conv_unsafe_charsets;
/* so that charset_name() works we need to get the UNIX<->UCS2 going
first */
@@ -146,6 +156,16 @@ void init_iconv(void)
init_valid_table();
conv_silent = False;
}
+
+ while(*unsafe_charset && strcmp(*unsafe_charset, conv_handles[CH_UCS2][CH_UNIX]->to_name)) {
+ unsafe_charset++;
+ }
+
+ if (*unsafe_charset) {
+ is_unix_charset_unsafe = True;
+ } else {
+ is_unix_charset_unsafe = False;
+ }
}
/**