lib/util/charset Don't allow invalid 'dos charset = utf8'
authorAndrew Bartlett <abartlet@samba.org>
Wed, 18 May 2011 01:51:37 +0000 (11:51 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 18 May 2011 14:12:08 +0000 (16:12 +0200)
No DOS client used UTF8, and this creates subtle, difficult to
disagnose breakage of schannel (domain membership).

Andrew Bartlett

lib/util/charset/codepoints.c
source3/utils/testparm.c

index 5e8ac64ed4f0e92ac0908f0f09b3ca6e78022a65..71611bfc4c1438f1bc773b761ad3c1b81983ac77 100644 (file)
@@ -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);
index 978ada26c653b814ced62d52345442b288932586..0e920ec69656e310275a5bdd3cb47aef3d9570a3 100644 (file)
@@ -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;
 }