summaryrefslogtreecommitdiff
path: root/lib/util/charset
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-08-04 13:36:42 -0700
committerJeremy Allison <jra@samba.org>2014-08-06 01:05:14 +0200
commitca1617121a2a6418c2e3ab7a7ce92ddaa1368ce2 (patch)
treeb1b25f02e75b624aceb2231a2241b05e71d3b377 /lib/util/charset
parentdfe8dd87e15bec453c7d3a80c4c707d3f2c7b597 (diff)
downloadsamba-ca1617121a2a6418c2e3ab7a7ce92ddaa1368ce2.tar.gz
s4: tests: Added local.charset test for Bug 10716 - smbd constantly crashes when filename contains non-ascii character
https://bugzilla.samba.org/show_bug.cgi?id=10716 Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/util/charset')
-rw-r--r--lib/util/charset/tests/charset.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/util/charset/tests/charset.c b/lib/util/charset/tests/charset.c
index 70b67418763..a47670e6665 100644
--- a/lib/util/charset/tests/charset.c
+++ b/lib/util/charset/tests/charset.c
@@ -50,12 +50,18 @@ static bool test_codepoint_cmpi(struct torture_context *tctx)
static bool test_strcasecmp_m(struct torture_context *tctx)
{
+ /* file.{accented e} in iso8859-1 */
+ const char file_iso8859_1[7] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xe9, 0 };
+ /* file.{accented e} in utf8 */
+ const char file_utf8[8] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xc3, 0xa9, 0 };
torture_assert(tctx, strcasecmp_m("foo", "bar") != 0, "different strings");
torture_assert(tctx, strcasecmp_m("foo", "foo") == 0, "same case strings");
torture_assert(tctx, strcasecmp_m("foo", "Foo") == 0, "different case strings");
torture_assert(tctx, strcasecmp_m(NULL, "Foo") != 0, "one NULL");
torture_assert(tctx, strcasecmp_m("foo", NULL) != 0, "other NULL");
torture_assert(tctx, strcasecmp_m(NULL, NULL) == 0, "both NULL");
+ torture_assert(tctx, strcasecmp_m(file_iso8859_1, file_utf8) != 0,
+ "file.{accented e} should differ");
return true;
}
@@ -102,6 +108,10 @@ static bool test_string_replace_m(struct torture_context *tctx)
static bool test_strncasecmp_m(struct torture_context *tctx)
{
+ /* file.{accented e} in iso8859-1 */
+ const char file_iso8859_1[7] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xe9, 0 };
+ /* file.{accented e} in utf8 */
+ const char file_utf8[8] = { 0x66, 0x69, 0x6c, 0x65, 0x2d, 0xc3, 0xa9, 0 };
torture_assert(tctx, strncasecmp_m("foo", "bar", 3) != 0, "different strings");
torture_assert(tctx, strncasecmp_m("foo", "foo", 3) == 0, "same case strings");
torture_assert(tctx, strncasecmp_m("foo", "Foo", 3) == 0, "different case strings");
@@ -111,6 +121,8 @@ static bool test_strncasecmp_m(struct torture_context *tctx)
torture_assert(tctx, strncasecmp_m(NULL, "Foo", 3) != 0, "one NULL");
torture_assert(tctx, strncasecmp_m("foo", NULL, 3) != 0, "other NULL");
torture_assert(tctx, strncasecmp_m(NULL, NULL, 3) == 0, "both NULL");
+ torture_assert(tctx, strncasecmp_m(file_iso8859_1, file_utf8, 6) != 0,
+ "file.{accented e} should differ");
return true;
}