summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorUri Simchoni <uri@samba.org>2016-08-15 23:39:50 +0300
committerKarolin Seeger <kseeger@samba.org>2016-09-13 12:27:27 +0200
commit5ba3f0c48f98008406a996950c7cd4821faca33f (patch)
tree1c725a3429c872f0df0cd1ae037d328d933e61c3 /source4
parent577b459d29323b6fb2d005aab1ce125ac7dc1131 (diff)
downloadsamba-5ba3f0c48f98008406a996950c7cd4821faca33f.tar.gz
seltest: allow opening files with arbitrary rights in smb2.ioctl tests
Separate file creation (which requires write access) from the opening of the file for the test (which might be without write access). BUG: https://bugzilla.samba.org/show_bug.cgi?id=12149 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> (cherry picked from commit 6ce0304eda4b464972defcecd591fab03428bd03)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smb2/ioctl.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index 8e7f69ad819..0aadca29b07 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -273,20 +273,36 @@ static bool test_setup_create_fill(struct torture_context *torture,
uint32_t file_attributes)
{
bool ok;
+ uint32_t initial_access = desired_access;
+
+ if (size > 0) {
+ initial_access |= SEC_FILE_APPEND_DATA;
+ }
smb2_util_unlink(tree, fname);
ok = test_setup_open(torture, tree, mem_ctx,
fname,
fh,
- desired_access,
+ initial_access,
file_attributes);
- torture_assert(torture, ok, "file open");
+ torture_assert(torture, ok, "file create");
if (size > 0) {
ok = write_pattern(torture, tree, mem_ctx, *fh, 0, size, 0);
torture_assert(torture, ok, "write pattern");
}
+
+ if (initial_access != desired_access) {
+ smb2_util_close(tree, *fh);
+ ok = test_setup_open(torture, tree, mem_ctx,
+ fname,
+ fh,
+ desired_access,
+ file_attributes);
+ torture_assert(torture, ok, "file open");
+ }
+
return true;
}