From 0006741aac0ae12fffc6235f1a46acb8cf583ff7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 18 May 2011 11:51:37 +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 | 6 ++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c index 5e8ac64..71611bf 100644 --- a/lib/util/charset/codepoints.c +++ b/lib/util/charset/codepoints.c @@ -290,6 +290,11 @@ _PUBLIC_ struct smb_iconv_handle *smb_iconv_handle_reinit(TALLOC_CTX *mem_ctx, talloc_set_destructor(ret, close_iconv_handle); + 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..0e920ec 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -240,12 +240,18 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_ if (!lp_passdb_backend()) { fprintf(stderr,"ERROR: passdb backend must have a value or be left out\n"); + ret = 1; } if (lp_os_level() > 255) { 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