s4/torture: vfs_fruit: add stream with illegal ntfs characters to copyile test
authorRalph Boehme <slow@samba.org>
Fri, 17 Feb 2017 15:35:44 +0000 (16:35 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 1 Mar 2017 23:32:23 +0000 (00:32 +0100)
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 <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source4/torture/vfs/fruit.c

index 92ef06aa1cd9fc219c36bd47fc433dcff54eac66..d74a153c1a2ffb7b1482a84f62e4ad43a293387a 100644 (file)
@@ -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);