From fa2f7d60462bab8c268fc5921b80861d85534771 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 23 May 2011 12:34:16 +1000 Subject: [PATCH] lib/util/charset Don't allow invalid 'dos charset = utf8' No DOS client used UTF8, and this creates subtle, difficult to disagnose breakage of schannel (domain membership). Andrew Bartlett --- lib/util/charset/codepoints.c | 5 +++++ source3/utils/testparm.c | 5 +++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c index 5ee95a8..aceacb6 100644 --- a/lib/util/charset/codepoints.c +++ b/lib/util/charset/codepoints.c @@ -281,6 +281,11 @@ _PUBLIC_ struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX * talloc_set_destructor(ret, close_iconv_convenience); + if (strcasecmp(dos_charset, "UTF8") == 0 || strcasecmp(dos_charset, "UTF-8") == 0) { + DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not be UTF8, using (default value) CP850 instead\n")); + dos_charset = "CP850"; + } + ret->dos_charset = talloc_strdup(ret->child_ctx, dos_charset); ret->unix_charset = talloc_strdup(ret->child_ctx, unix_charset); ret->display_charset = talloc_strdup(ret->child_ctx, display_charset); diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 978ada2..9a484b6 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -246,6 +246,11 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_ fprintf(stderr,"WARNING: Maximum value for 'os level' is 255!\n"); } + if (strequal(lp_dos_charset(), "UTF8") || strequal(lp_dos_charset(), "UTF-8")) { + fprintf(stderr, "ERROR: 'dos charset' must not be UTF8\n"); + ret = 1; + } + return ret; } -- 1.7.4.4