summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-10-11 17:14:50 +0200
committerKarolin Seeger <kseeger@samba.org>2018-11-06 09:10:24 +0100
commit76fb134af8558ee6843e300c32617608a2f2dca8 (patch)
treeb126337db5ac1836e79cfda0509edfb47316912f /source4/torture
parente38c76eed418c54e089c0442974bfbb900d0ff45 (diff)
downloadsamba-76fb134af8558ee6843e300c32617608a2f2dca8.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> (cherry picked from commit aba502d440ae3478543d3be5c5bbcea39fb0a463)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/vfs/fruit.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 669b7a66ac1..20f0e2b4e5b 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
*/