diff options
author | Ralph Boehme <slow@samba.org> | 2018-10-11 17:14:50 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-10-31 21:27:21 +0100 |
commit | aba502d440ae3478543d3be5c5bbcea39fb0a463 (patch) | |
tree | 95162dfef92fa16868ddfd400ba2d1dc05dac7e8 /source4 | |
parent | 64b28e4a94365092f46052712a38e6fcfbb9f20c (diff) | |
download | samba-aba502d440ae3478543d3be5c5bbcea39fb0a463.tar.gz |
s4:torture/vfs/fruit: add check_stream_list_handle()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/vfs/fruit.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index 0cd61a41479..24256e4c6bf 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -3082,6 +3082,68 @@ done: return ret; } +#if 0 +static bool check_stream_list_handle(struct smb2_tree *tree, + struct torture_context *tctx, + struct smb2_handle h, + int num_exp, + const char **exp, + bool is_dir) +{ + bool ret = true; + union smb_fileinfo finfo; + NTSTATUS status; + int i; + TALLOC_CTX *tmp_ctx = talloc_new(tctx); + char **exp_sort; + struct stream_struct *stream_sort; + + torture_assert_goto(tctx, tmp_ctx != NULL, ret, done, + "talloc_new failed\n"); + + finfo = (union smb_fileinfo) { + .stream_info.level = RAW_FILEINFO_STREAM_INFORMATION, + .stream_info.in.file.handle = h, + }; + + status = smb2_getinfo_file(tree, tctx, &finfo); + torture_assert_ntstatus_ok_goto(tctx, status, ret, done, + "get stream info\n"); + + torture_assert_int_equal_goto(tctx, finfo.stream_info.out.num_streams, + num_exp, ret, done, "stream count\n"); + + if (num_exp == 0) { + TALLOC_FREE(tmp_ctx); + goto done; + } + + exp_sort = talloc_memdup(tmp_ctx, exp, num_exp * sizeof(*exp)); + torture_assert_goto(tctx, exp_sort != NULL, ret, done, __location__); + + TYPESAFE_QSORT(exp_sort, num_exp, qsort_string); + + stream_sort = talloc_memdup(tmp_ctx, finfo.stream_info.out.streams, + finfo.stream_info.out.num_streams * + sizeof(*stream_sort)); + torture_assert_goto(tctx, stream_sort != NULL, ret, done, __location__); + + TYPESAFE_QSORT(stream_sort, finfo.stream_info.out.num_streams, qsort_stream); + + for (i=0; i<num_exp; i++) { + torture_comment(tctx, "i[%d] exp[%s] got[%s]\n", + i, exp_sort[i], stream_sort[i].stream_name.s); + torture_assert_str_equal_goto(tctx, stream_sort[i].stream_name.s, + exp_sort[i], ret, done, + "stream name\n"); + } + +done: + TALLOC_FREE(tmp_ctx); + return ret; +} +#endif + /* test stream names */ |