[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Sat Sep 10 07:46:02 MDT 2011


The branch, master has been updated
       via  86b1f45 lib/util/charset: the comparsion must be against our charset modules
       via  142f871 lib/util/charset Use name of ISO-8859-1 that matches our internal implementation
       via  0022296 lib/util/charset: Improve toture assertions in iconv test
       via  2085dff lib/util/charset Run charset sets with and without the system iconv
       via  fc6bb5d lib/util/charset: add back loading of charset modules
      from  258ffdd libcli/smb: s/FLAGS2_UNKNOWN_BIT4/FLAGS2_SMB_SECURITY_SIGNATURES_REQUIRED

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 86b1f45a5e763893a038bf854dfe735c86f3f30b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Sep 10 15:51:45 2011 +1000

    lib/util/charset: the comparsion must be against our charset modules
    
    There is little point testing this against the system iconv.
    
    Andrew Bartlett
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Sat Sep 10 15:45:42 CEST 2011 on sn-devel-104

commit 142f871cef8f1b239d01d65dfeba3331cff0e166
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Sep 10 15:41:14 2011 +1000

    lib/util/charset Use name of ISO-8859-1 that matches our internal implementation

commit 0022296349ef95896b0e83a5ac496edba043a98c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Sep 10 13:23:22 2011 +1000

    lib/util/charset: Improve toture assertions in iconv test

commit 2085dffddb36e8ac3cfe83c3f318d49c96408274
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Sep 10 09:53:29 2011 +1000

    lib/util/charset Run charset sets with and without the system iconv
    
    We need to know that we can load the samba-provided modules, and that
    they are correct.  However, we must mark a number of tests as
    knownfail due to errors in our internal iconv modules.
    
    Andrew Bartlett

commit fc6bb5d47a985d0215c2a8ea9a00c21abf131ad9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Sep 9 23:51:06 2011 +1000

    lib/util/charset: add back loading of charset modules
    
    For autoconf builds these remain as modules, for waf builds they are
    built into the charset library.
    
    This is required to provide the CP850 charset when iconv is not available.
    
    The charset modules static for the waf builds because with proper
    shared libs, there isn't the same need for these to be in seperate .so
    files.  The modules are also not produced if a system iconv is found,
    except for developers, to allow testing of both code paths.
    
    Andrew Bartlett

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

Summary of changes:
 lib/util/charset/charset.h              |    3 +-
 lib/util/charset/codepoints.c           |    5 +-
 lib/util/charset/iconv.c                |   78 ++++++++++++++-------
 lib/util/charset/tests/convert_string.c |  114 +++++++++++++++++--------------
 lib/util/charset/tests/iconv.c          |   19 ++++-
 lib/util/charset/wscript_build          |   20 +++--
 source3/wscript                         |   17 +++--
 source4/selftest/knownfail              |    3 +
 source4/selftest/tests.py               |    6 ++
 9 files changed, 169 insertions(+), 96 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index ce297d0..20887e0 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -182,7 +182,8 @@ extern struct smb_iconv_handle *global_iconv_handle;
 struct smb_iconv_handle *get_iconv_handle(void);
 struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx, 
 						  const char *dos_charset, 
-						  const char *unix_charset);
+						  const char *unix_charset,
+						  bool native_iconv);
 smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic,
 			    charset_t from, charset_t to);
 const char *charset_name(struct smb_iconv_handle *ic, charset_t ch);
diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c
index 8cc33a9..0d1020f 100644
--- a/lib/util/charset/codepoints.c
+++ b/lib/util/charset/codepoints.c
@@ -174,10 +174,11 @@ struct smb_iconv_handle *get_iconv_handle(void)
 
 struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx, 
 						  const char *dos_charset, 
-						  const char *unix_charset)
+						  const char *unix_charset,
+						  bool native_iconv)
 {
 	return smb_iconv_handle_reinit(mem_ctx,
-				       dos_charset, unix_charset, true, NULL);
+				       dos_charset, unix_charset, native_iconv, NULL);
 }
 
 /**
diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c
index f63c4e6..fd8b8ae 100644
--- a/lib/util/charset/iconv.c
+++ b/lib/util/charset/iconv.c
@@ -244,7 +244,7 @@ static int smb_iconv_t_destructor(smb_iconv_t hwd)
 }
 
 _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode, 
-			      const char *fromcode, bool native_iconv)
+			      const char *fromcode, bool allow_native_iconv)
 {
 	smb_iconv_t ret;
 	const struct charset_functions *from=NULL, *to=NULL;
@@ -268,6 +268,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
 		return ret;
 	}
 
+	/* check if we have a builtin function for this conversion */
 	for (i=0;i<ARRAY_SIZE(builtin_functions);i++) {
 		if (strcasecmp(fromcode, builtin_functions[i].name) == 0) {
 			from = &builtin_functions[i];
@@ -277,43 +278,68 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode,
 		}
 	}
 
-	if (from == NULL) {
-		for (from=charsets; from; from=from->next) {
-			if (strcasecmp(from->name, fromcode) == 0) break;
-		}
-	}
-
-	if (to == NULL) {
-		for (to=charsets; to; to=to->next) {
-			if (strcasecmp(to->name, tocode) == 0) break;
-		}
-	}
-
 #ifdef HAVE_NATIVE_ICONV
-	if ((!from || !to) && !native_iconv) {
-		goto failed;
-	}
-	if (!from) {
-		ret->pull = sys_iconv;
+	/* the from and to varaibles indicate a samba module or
+	 * internal conversion, ret->pull and ret->push are
+	 * initialised only in this block for iconv based
+	 * conversions */
+
+	if (allow_native_iconv && from == NULL) {
 		ret->cd_pull = iconv_open("UTF-16LE", fromcode);
 		if (ret->cd_pull == (iconv_t)-1)
 			ret->cd_pull = iconv_open("UCS-2LE", fromcode);
-		if (ret->cd_pull == (iconv_t)-1) goto failed;
+		if (ret->cd_pull != (iconv_t)-1) {
+			ret->pull = sys_iconv;
+		}
 	}
-
-	if (!to) {
-		ret->push = sys_iconv;
+	
+	if (allow_native_iconv && to == NULL) {
 		ret->cd_push = iconv_open(tocode, "UTF-16LE");
 		if (ret->cd_push == (iconv_t)-1)
 			ret->cd_push = iconv_open(tocode, "UCS-2LE");
-		if (ret->cd_push == (iconv_t)-1) goto failed;
+		if (ret->cd_push != (iconv_t)-1) {
+			ret->push = sys_iconv;
+		}
 	}
-#else
-	if (!from || !to) {
-		goto failed;
+#endif
+
+	/* If iconv was unable to provide the conversion, or if use of
+	 * it was disabled, and it wasn't a builtin charset, try a
+	 * module */
+	if (ret->pull == NULL && from == NULL) {
+		from = find_charset_functions(fromcode);
+	}
+	
+	if (ret->push == NULL && to == NULL) {
+		to = find_charset_functions(tocode);
+	}
+
+	/* In the WAF builds, all charset modules are linked in at compile
+	 * time, as we have shared libs.  Using run-time loading as well will
+	 * cause dependency loops.  For the autoconf build, try loading from a module */
+#ifndef _SAMBA_WAF_BUILD_
+	/* check if there is a module available that can do this conversion */
+	if (from == NULL && ret->pull == NULL && NT_STATUS_IS_OK(smb_probe_module("charset", fromcode))) {
+		if (!(from = find_charset_functions(fromcode))) {
+			DEBUG(0, ("Module %s doesn't provide charset %s!\n", fromcode, fromcode));
+		}
+	}
+	
+	if (to == NULL && ret->push == NULL && NT_STATUS_IS_OK(smb_probe_module("charset", tocode))) {
+		if (!(to = find_charset_functions(tocode))) {
+			DEBUG(0, ("Module %s doesn't provide charset %s!\n", tocode, tocode));
+		}
 	}
 #endif
 
+	if (ret->pull == NULL && from == NULL) {
+		goto failed;
+	}
+	
+	if (ret->push == NULL && to == NULL) {
+		goto failed;
+	}
+
 	/* check for conversion to/from ucs2 */
 	if (is_utf16(fromcode) && to) {
 		ret->direct = to->push;
diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c
index 9a5d974..2c0fe9f 100644
--- a/lib/util/charset/tests/convert_string.c
+++ b/lib/util/charset/tests/convert_string.c
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "torture/torture.h"
 #include "lib/util/charset/charset.h"
+#include "param/param.h"
 
 /* The text below is in ancient and a latin charset transliteration of
  * greek, and an english translation.  It from Apology by Plato and sourced from
@@ -105,23 +106,24 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 	talloc_steal(tctx, gd_iso8859_1.data);
 	talloc_steal(tctx, gd_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 		
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_UTF8, CH_DOS, 
 						    gd_utf8.data, gd_utf8.length, 
 						    (void *)&gd_output.data, &gd_output.length), 
-		       "conversion from UTF8 to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_error_handle(iconv_handle,
 							 CH_UTF8, CH_DOS,
 							 gd_utf8.data, gd_utf8.length,
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length),
-		       "conversion from UTF8 to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
 
 	/* Short output handling confirmation */
 	gd_output.length = 1;
@@ -130,10 +132,10 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 							 gd_utf8.data, gd_utf8.length,
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
-		       "conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
-	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
+	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
 	torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
-	torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
+	torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
 
 	/* Short output handling confirmation */
 	gd_output.length = 2;
@@ -142,8 +144,8 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 							 gd_utf8.data, gd_utf8.length,
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
-		       "conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
-	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
+	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
 	torture_assert_int_equal(tctx, gd_output.length, 2, "Should only get 2 char of output");
 
 	/* Short input handling confirmation */
@@ -153,8 +155,8 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 							 gd_utf8.data, 2,
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
-		       "conversion from UTF8 to (dos charset) ISO8859-1 should fail due to too short");
-	torture_assert_errno_equal(tctx, EILSEQ, "conversion from short UTF8 to (dos charset) ISO8859-1 should fail EINVAL");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1 should fail due to too short");
+	torture_assert_errno_equal(tctx, EILSEQ, "conversion from short UTF8 to (dos charset) ISO-8859-1 should fail EINVAL");
 	torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
 
 	/* Short output handling confirmation */
@@ -165,7 +167,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
 		       "conversion from UTF16 to UTF8 should fail due to too short");
-	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO8859-1 should fail E2BIG");
+	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO-8859-1 should fail E2BIG");
 	torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
 	torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "conversion from UTF16 to UTF8 incorrect");
 
@@ -177,7 +179,7 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
 		       "conversion from UTF16 to UTF8 should fail due to too short");
-	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO8859-1 should fail E2BIG");
+	torture_assert_errno_equal(tctx, E2BIG, "conversion from UTF16 to (utf8 charset) ISO-8859-1 should fail E2BIG");
 	torture_assert_int_equal(tctx, gd_output.length, 3, "Should get 3 bytes output for UTF8");
 
 	/* Short input handling confirmation */
@@ -209,15 +211,15 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 						    CH_UTF16LE, CH_DOS, 
 						    gd_utf16le.data, gd_utf16le.length, 
 						    (void *)&gd_output.data, &gd_output.length),
-		       "conversion from UTF16LE to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
+		       "conversion from UTF16LE to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF16LE, 
 						    gd_output.data, gd_output.length, 
 						    (void *)&gd_output2.data, &gd_output2.length),
-		       "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
-	torture_assert_data_blob_equal(tctx, gd_output2, gd_utf16le,  "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
+		       "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
+	torture_assert_data_blob_equal(tctx, gd_output2, gd_utf16le,  "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_UTF16LE, CH_UNIX, 
@@ -237,29 +239,29 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 						    CH_DOS, CH_DOS, 
 						    gd_iso8859_1.data, gd_iso8859_1.length, 
 						    (void *)&gd_output.data, &gd_output.length),
-		       "conversion from (dos charset) ISO8859-1 to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
+		       "conversion from (dos charset) ISO-8859-1 to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UNIX, 
 						    gd_iso8859_1.data, gd_iso8859_1.length, 
 						    (void *)&gd_output.data, &gd_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to (unix charset) CP850");
+		       "conversion from (dos charset) ISO-8859-1 to (unix charset) CP850");
 	torture_assert_data_blob_equal(tctx, gd_output, gd_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF8, 
 						    gd_iso8859_1.data, gd_iso8859_1.length, 
 						    (void *)&gd_output.data, &gd_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to UTF8");
+		       "conversion from (dos charset) ISO-8859-1 to UTF8");
 	torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from UTF16LE to UTF8 incorrect");
 
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF16LE, 
 						    gd_iso8859_1.data, gd_iso8859_1.length, 
 						    (void *)&gd_output.data, &gd_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to UTF16LE");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_utf16le, "conversion from (dos charset) ISO8859-1 to UTF16LE");
+		       "conversion from (dos charset) ISO-8859-1 to UTF16LE");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_utf16le, "conversion from (dos charset) ISO-8859-1 to UTF16LE");
 	torture_assert_int_equal(tctx,
 				 strlen_m_ext_handle(iconv_handle,
 						     (const char *)gd_iso8859_1.data,
@@ -271,14 +273,14 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
 						    CH_DOS, CH_UTF8,
 						    gd_iso8859_1.data, gd_iso8859_1.length,
 						    (void *)&gd_output.data, &gd_output.length),
-		       "conversion from (dos charset) ISO8859-1 to UTF8");
-	torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from (dos charset) ISO8859-1 to UTF8");
+		       "conversion from (dos charset) ISO-8859-1 to UTF8");
+	torture_assert_data_blob_equal(tctx, gd_output, gd_utf8, "conversion from (dos charset) ISO-8859-1 to UTF8");
 	torture_assert_int_equal(tctx,
 				 strlen_m_ext_handle(iconv_handle,
 						     (const char *)gd_iso8859_1.data,
 						     CH_DOS, CH_UTF8),
 				 gd_output.length,
-				 "checking strlen_m_ext of conversion from (dos charset) ISO8859-1 to UTF8");
+				 "checking strlen_m_ext of conversion from (dos charset) ISO-8859-1 to UTF8");
 	return true;
 }
 
@@ -297,7 +299,8 @@ static bool test_gd_minus_1_handle(struct torture_context *tctx)
 	talloc_steal(tctx, gd_cp850.data);
 	talloc_steal(tctx, gd_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850", 
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 
 	gd_utf8_terminated = data_blob_talloc(tctx, NULL, gd_utf8.length + 1);
@@ -481,7 +484,8 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
 	talloc_steal(tctx, gd_iso8859_1.data);
 	talloc_steal(tctx, gd_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
+	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8", 
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@@ -498,7 +502,7 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
 		       "conversion from UTF8 to (dos charset) ASCII should fail");
-	torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO8859-1 should fail E2BIG");
+	torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail E2BIG");
 	torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 1 char of output");
 	torture_assert_data_blob_equal(tctx, gd_output, data_blob_string_const("G"), "partial conversion from UTF8 to (dos charset) ASCII incorrect");
 
@@ -522,7 +526,7 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
 							 (void *)gd_output.data, gd_output.length,
 							 &gd_output.length) == false,
 		       "conversion from UTF8 to (dos charset) ASCII should fail due to too illigal seqence");
-	torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO8859-1 should fail EILSEQ");
+	torture_assert_errno_equal(tctx, EILSEQ, "conversion from UTF8 to (dos charset) ISO-8859-1 should fail EILSEQ");
 	torture_assert_int_equal(tctx, gd_output.length, 1, "Should only get 2 char of output");
 
 	/* Short input handling confirmation */
@@ -550,15 +554,16 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
 	
 	talloc_steal(tctx, plato_english_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850", 
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 		
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_UTF8, CH_DOS, 
 						    plato_english_utf8.data, plato_english_utf8.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length), 
-		       "conversion from UTF8 to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF8 to (dos charset) ISO8859-1 incorrect");
+		       "conversion from UTF8 to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF8 to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_UTF8, CH_UNIX, 
@@ -578,15 +583,15 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
 						    CH_UTF16LE, CH_DOS, 
 						    plato_english_utf16le.data, plato_english_utf16le.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length),
-		       "conversion from UTF16LE to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
+		       "conversion from UTF16LE to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF16LE, 
 						    plato_english_output.data, plato_english_output.length, 
 						    (void *)&plato_english_output2.data, &plato_english_output2.length),
-		       "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
-	torture_assert_data_blob_equal(tctx, plato_english_output2, plato_english_utf16le,  "round trip conversion from (dos charset) ISO8859-1 back to UTF16LE");
+		       "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
+	torture_assert_data_blob_equal(tctx, plato_english_output2, plato_english_utf16le,  "round trip conversion from (dos charset) ISO-8859-1 back to UTF16LE");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_UTF16LE, CH_UTF8,
@@ -631,29 +636,29 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
 						    CH_DOS, CH_DOS, 
 						    plato_english_iso8859_1.data, plato_english_iso8859_1.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length),
-		       "conversion from (dos charset) ISO8859-1 to (dos charset) ISO8859-1");
-	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO8859-1 incorrect");
+		       "conversion from (dos charset) ISO-8859-1 to (dos charset) ISO-8859-1");
+	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_iso8859_1, "conversion from UTF16LE to (dos charset) ISO-8859-1 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UNIX, 
 						    plato_english_iso8859_1.data, plato_english_iso8859_1.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to (unix charset) CP850");
+		       "conversion from (dos charset) ISO-8859-1 to (unix charset) CP850");
 	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_cp850, "conversion from UTF16LE to (unix charset) CP850 incorrect");
 	
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF8, 
 						    plato_english_iso8859_1.data, plato_english_iso8859_1.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to UTF8");
+		       "conversion from (dos charset) ISO-8859-1 to UTF8");
 	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf8, "conversion from UTF16LE to UTF8 incorrect");
 
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
 						    CH_DOS, CH_UTF16LE, 
 						    plato_english_iso8859_1.data, plato_english_iso8859_1.length, 
 						    (void *)&plato_english_output.data, &plato_english_output.length), 
-		       "conversion from (dos charset) ISO8859-1 to UTF16LE");
-	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf16le, "conversion from (dos charset) ISO8859-1 to UTF16LE");
+		       "conversion from (dos charset) ISO-8859-1 to UTF16LE");
+	torture_assert_data_blob_equal(tctx, plato_english_output, plato_english_utf16le, "conversion from (dos charset) ISO-8859-1 to UTF16LE");
 	return true;
 }
 
@@ -668,7 +673,8 @@ static bool test_plato_english_minus_1_handle(struct torture_context *tctx)
 	
 	talloc_steal(tctx, plato_english_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850", 
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 
 	plato_english_utf8_terminated = data_blob_talloc(tctx, NULL, plato_english_utf8.length + 1);
@@ -809,7 +815,8 @@ static bool test_plato_minus_1_handle(struct torture_context *tctx)
 	talloc_steal(tctx, plato_utf8.data);
 	talloc_steal(tctx, plato_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "ISO-8859-1", "CP850",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting iconv handle");
 
 	plato_utf8_terminated = data_blob_talloc(tctx, NULL, plato_utf8.length + 1);
@@ -923,7 +930,8 @@ static bool test_plato_cp850_utf8_handle(struct torture_context *tctx)
 	talloc_steal(tctx, plato_utf8.data);
 	talloc_steal(tctx, plato_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8");
+	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8", 
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "creating iconv handle");
 		
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
@@ -1114,7 +1122,8 @@ static bool test_plato_latin_cp850_utf8_handle(struct torture_context *tctx)
 	talloc_steal(tctx, plato_latin_utf8.data);
 	talloc_steal(tctx, plato_latin_utf16le.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8");
+	iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "creating iconv handle");
 		
 	torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, 
@@ -1182,7 +1191,8 @@ static bool test_gd_case_utf8_handle(struct torture_context *tctx)
 	char *gd_lower, *gd_upper;
 	talloc_steal(tctx, gd_utf8.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
+	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
 
 	torture_assert(tctx,
@@ -1245,7 +1255,8 @@ static bool test_gd_case_cp850_handle(struct torture_context *tctx)
 	char *gd_lower, *gd_upper;
 	talloc_steal(tctx, gd_cp850.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850");
+	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting cp850 iconv handle");
 
 	torture_assert(tctx,
@@ -1306,7 +1317,8 @@ static bool test_plato_case_utf8_handle(struct torture_context *tctx)
 	char *plato_lower, *plato_upper;
 	talloc_steal(tctx, plato_utf8.data);
 
-	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8");
+	iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8",
+						lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
 	torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list