[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Thu May 26 12:06:59 MDT 2011


The branch, v3-6-test has been updated
       via  0b45809 Fix bug #8150 - Ban 'dos charset = utf8'
      from  341694e s3: Document "async smb echo handler"

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 0b45809109bfbb5bca7913091b465afbd1462103
Author: Jeremy Allison <jra at samba.org>
Date:   Mon May 23 10:57:56 2011 -0700

    Fix bug #8150 - Ban 'dos charset = utf8'

-----------------------------------------------------------------------

Summary of changes:
 source3/param/loadparm.c |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 73406c1..be99759 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -708,6 +708,7 @@ static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
+static bool handle_dos_charset( int snum, const char *pszParmValue, char **ptr );
 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
 
@@ -955,7 +956,7 @@ static struct parm_struct parm_table[] = {
 		.type		= P_STRING,
 		.p_class	= P_GLOBAL,
 		.ptr		= &Globals.dos_charset,
-		.special	= handle_charset,
+		.special	= handle_dos_charset,
 		.enum_list	= NULL,
 		.flags		= FLAG_ADVANCED
 	},
@@ -7531,6 +7532,43 @@ static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
 	return True;
 }
 
+static bool handle_dos_charset(int snum, const char *pszParmValue, char **ptr)
+{
+	bool is_utf8 = false;
+	size_t len = strlen(pszParmValue);
+
+	if (len == 4 || len == 5) {
+		/* Don't use StrCaseCmp here as we don't want to
+		   initialize iconv. */
+		if ((toupper_ascii(pszParmValue[0]) == 'U') &&
+		    (toupper_ascii(pszParmValue[1]) == 'T') &&
+		    (toupper_ascii(pszParmValue[2]) == 'F')) {
+			if (len == 4) {
+				if (pszParmValue[3] == '8') {
+					is_utf8 = true;
+				}
+			} else {
+				if (pszParmValue[3] == '-' &&
+				    pszParmValue[4] == '8') {
+					is_utf8 = true;
+				}
+			}
+		}
+	}
+
+	if (strcmp(*ptr, pszParmValue) != 0) {
+		if (is_utf8) {
+			DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not "
+				"be UTF8, using (default value) %s instead.\n",
+				DEFAULT_DOS_CHARSET));
+			pszParmValue = DEFAULT_DOS_CHARSET;
+		}
+		string_set(ptr, pszParmValue);
+		init_iconv();
+	}
+	return True;
+}
+
 
 
 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list