diff options
-rw-r--r-- | lib/util/charset/charset.h | 3 | ||||
-rw-r--r-- | lib/util/charset/codepoints.c | 5 | ||||
-rw-r--r-- | lib/util/charset/tests/convert_string.c | 34 | ||||
-rw-r--r-- | source4/selftest/knownfail | 3 | ||||
-rwxr-xr-x | source4/selftest/tests.py | 6 |
5 files changed, 37 insertions, 14 deletions
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index ce297d0ddd..20887e0e9d 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 8cc33a9782..0d1020f7a0 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/tests/convert_string.c b/lib/util/charset/tests/convert_string.c index 9a5d974fe3..ff19a579bd 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,7 +106,8 @@ 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, "ISO8859-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, @@ -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, @@ -550,7 +554,8 @@ 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, "ISO8859-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, @@ -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, "ISO8859-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, "ISO8859-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"); torture_assert(tctx, diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail index 915591b9e3..0152676b77 100644 --- a/source4/selftest/knownfail +++ b/source4/selftest/knownfail @@ -5,6 +5,9 @@ # a successful run for any of these tests an error. ^samba4.local.resolve.*.async ^samba4.local.iconv.*.next_codepoint() +^samba4.local.iconv.5M random UTF-16LE sequences # Fails because our CP850 module returns the wrong error codes +^samba4.local.convert_string_handle.iconv.modules.plato_cp850_utf8 +^samba4.local.convert_string.iconv.modules.plato ^samba4..*base.delete.*.deltest17 ^samba4..*base.delete.*.deltest20a ^samba4..*base.delete.*.deltest20b diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index 21e19554ba..f64a803a78 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -267,6 +267,12 @@ plansmbtorturetestsuite('echo.udp', 'dc:local', '//$SERVER/whatever') for t in smb4torture_testsuites("local."): plansmbtorturetestsuite(t, "none", "ncalrpc:") +# Confirm these tests with the system iconv too +for t in ["local.convert_string_handle", "local.convert_string", "local.ndr"]: + modname = "samba4.%s.iconv.modules" % t + cmdline = "%s %s %s" % (valgrindify(smb4torture), "ncalrpc: --option='iconv:native=false'", t) + plantestsuite_loadlist(modname, env, cmdline) + tdbtorture4 = binpath("tdbtorture") if os.path.exists(tdbtorture4): plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4)) |