struct srv_copychunk_copy cc_copy;
enum ndr_err_code ndr_ret;
bool ok;
+ /* read permission on src */
+ ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
+ &src_h, 4096, /* fill 4096 byte src file */
+ SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
+ &dest_h, 0, /* 0 byte dest file */
+ SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
+ if (!ok) {
+ torture_fail(torture, "setup copy chunk error");
+ }
- /* no read permission on src */
- ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
- 1, /* 1 chunk */
+ cc_copy.chunks[0].source_off = 0;
+ cc_copy.chunks[0].target_off = 0;
+ cc_copy.chunks[0].length = 4096;
+
+ ndr_ret = ndr_push_struct_blob(
+ &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
+ (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
+ torture_assert_ndr_success(torture, ndr_ret,
+ "ndr_push_srv_copychunk_copy");
+
+ status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
+ torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
+ "FSCTL_SRV_COPYCHUNK");
+
+ smb2_util_close(tree, src_h);
+ smb2_util_close(tree, dest_h);
+
+ /* execute permission on src */
+ ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
&src_h, 4096, /* fill 4096 byte src file */
- SEC_RIGHTS_FILE_WRITE,
- &dest_h, 0, /* 0 byte dest file */
- SEC_RIGHTS_FILE_ALL,
- &cc_copy,
- &ioctl);
+ SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
+ &dest_h, 0, /* 0 byte dest file */
+ SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
+ if (!ok) {
+ torture_fail(torture, "setup copy chunk error");
+ }
+
+ cc_copy.chunks[0].source_off = 0;
+ cc_copy.chunks[0].target_off = 0;
+ cc_copy.chunks[0].length = 4096;
+
+ ndr_ret = ndr_push_struct_blob(
+ &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
+ (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
+ torture_assert_ndr_success(torture, ndr_ret,
+ "ndr_push_srv_copychunk_copy");
+
+ status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
+ torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
+ "FSCTL_SRV_COPYCHUNK");
+
+ smb2_util_close(tree, src_h);
+ smb2_util_close(tree, dest_h);
+
+ /* neither read nor execute permission on src */
+ ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
+ &src_h, 4096, /* fill 4096 byte src file */
+ SEC_FILE_READ_ATTRIBUTE, &dest_h,
+ 0, /* 0 byte dest file */
+ SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
if (!ok) {
torture_fail(torture, "setup copy chunk error");
}
smb2_util_close(tree, dest_h);
/* no write permission on dest */
- ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
- 1, /* 1 chunk */
- &src_h, 4096, /* fill 4096 byte src file */
- SEC_RIGHTS_FILE_ALL,
- &dest_h, 0, /* 0 byte dest file */
- (SEC_RIGHTS_FILE_READ
- | SEC_RIGHTS_FILE_EXECUTE),
- &cc_copy,
- &ioctl);
+ ok = test_setup_copy_chunk(
+ torture, tree, tmp_ctx, 1, /* 1 chunk */
+ &src_h, 4096, /* fill 4096 byte src file */
+ SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE, &dest_h,
+ 0, /* 0 byte dest file */
+ (SEC_RIGHTS_FILE_ALL &
+ ~(SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)),
+ &cc_copy, &ioctl);
if (!ok) {
torture_fail(torture, "setup copy chunk error");
}
smb2_util_close(tree, dest_h);
/* no read permission on dest */
- ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
- 1, /* 1 chunk */
+ ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
&src_h, 4096, /* fill 4096 byte src file */
- SEC_RIGHTS_FILE_ALL,
- &dest_h, 0, /* 0 byte dest file */
- (SEC_RIGHTS_FILE_WRITE
- | SEC_RIGHTS_FILE_EXECUTE),
- &cc_copy,
- &ioctl);
+ SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
+ &dest_h, 0, /* 0 byte dest file */
+ (SEC_RIGHTS_FILE_ALL & ~SEC_FILE_READ_DATA),
+ &cc_copy, &ioctl);
if (!ok) {
torture_fail(torture, "setup copy chunk error");
}