From: Ralph Boehme Date: Fri, 17 Feb 2017 15:35:44 +0000 (+0100) Subject: s4/torture: vfs_fruit: add stream with illegal ntfs characters to copyile test X-Git-Tag: tdb-1.3.13~687 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7a79a9b35225f41eeae961ab340882c7d49f0c4;p=thirdparty%2Fsamba.git s4/torture: vfs_fruit: add stream with illegal ntfs characters to copyile test This ensures a stream with illegal NTFS characters mapped to the Unicode private range like :foo\xef\x80\xa2bar:$DATA that is stored as an xattr name user.DosStream.foo:bar:$DATA if "fruit:encoding = native" is set, is copied by the special fruit copy_chunk request. Bug: https://bugzilla.samba.org/show_bug.cgi?id=12427 Signed-off-by: Ralph Boehme Reviewed-by: Uri Simchoni --- diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index 92ef06aa1cd..d74a153c1a2 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -2451,6 +2451,7 @@ static bool test_copyfile(struct torture_context *torture, struct srv_copychunk_rsp cc_rsp; enum ndr_err_code ndr_ret; bool ok; + const char *sname = ":foo" "\xef\x80\xa2" "bar:$DATA"; /* * First test a copy_chunk with a 0 chunk count without having @@ -2521,6 +2522,11 @@ static bool test_copyfile(struct torture_context *torture, torture_fail(torture, "setup stream error"); } + ok = write_stream(tree, __location__, torture, tmp_ctx, + FNAME_CC_SRC, sname, + 10, 10, "abcdefghij"); + torture_assert_goto(torture, ok == true, ok, done, "write_stream failed\n"); + ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 0, /* 0 chunks, copyfile semantics */ &src_h, 4096, /* fill 4096 byte src file */ @@ -2573,6 +2579,11 @@ static bool test_copyfile(struct torture_context *torture, torture_fail_goto(torture, done, "inconsistent stream data"); } + ok = check_stream(tree, __location__, torture, tmp_ctx, + FNAME_CC_DST, sname, + 0, 20, 10, 10, "abcdefghij"); + torture_assert_goto(torture, ok == true, ok, done, "check_stream failed\n"); + done: smb2_util_close(tree, src_h); smb2_util_close(tree, dest_h);