summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/create.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-30 12:18:07 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-30 12:18:07 +0200
commit5107f093c270f7a0dfc359de088b475fffc4e279 (patch)
tree99f616c6e352f87fbd41e60ad7fae3adf67e72fa /source4/torture/smb2/create.c
parent46f22add9ae03b95f4b22235c297737475427f41 (diff)
parentbe1927cd80838a6807827cef4431c03160d52582 (diff)
downloadsamba-5107f093c270f7a0dfc359de088b475fffc4e279.tar.gz
samba-5107f093c270f7a0dfc359de088b475fffc4e279.tar.bz2
samba-5107f093c270f7a0dfc359de088b475fffc4e279.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-defs
Conflicts: source/samba4-skip (This used to be commit 7b0e0eb346c2f6a240b20fbcf14029539c6512b9)
Diffstat (limited to 'source4/torture/smb2/create.c')
-rw-r--r--source4/torture/smb2/create.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index 733b2c2e8a..c23ff8b8ce 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -41,7 +41,7 @@
if (v != correct) { \
printf("(%s) Incorrect value for %s 0x%08llx - should be 0x%08llx\n", \
__location__, #v, (unsigned long long)v, (unsigned long long)correct); \
- return false; \
+ return false; \
}} while (0)
/*
@@ -52,7 +52,8 @@ static bool test_create_gentest(struct torture_context *torture, struct smb2_tre
struct smb2_create io;
NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_new(tree);
- uint32_t access_mask, file_attributes, denied_mask;
+ uint32_t access_mask, file_attributes, file_attributes_set, denied_mask;
+ union smb_fileinfo q;
ZERO_STRUCT(io);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -115,7 +116,8 @@ static bool test_create_gentest(struct torture_context *torture, struct smb2_tre
for (i=0;i<32;i++) {
io.in.desired_access = 1<<i;
status = smb2_create(tree, tmp_ctx, &io);
- if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
+ NT_STATUS_EQUAL(status, NT_STATUS_PRIVILEGE_NOT_HELD)) {
access_mask |= io.in.desired_access;
} else {
CHECK_STATUS(status, NT_STATUS_OK);
@@ -131,6 +133,7 @@ static bool test_create_gentest(struct torture_context *torture, struct smb2_tre
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
io.in.file_attributes = 0;
file_attributes = 0;
+ file_attributes_set = 0;
denied_mask = 0;
{
int i;
@@ -146,12 +149,14 @@ static bool test_create_gentest(struct torture_context *torture, struct smb2_tre
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_util_close(tree, io.out.file.handle);
CHECK_STATUS(status, NT_STATUS_OK);
+ file_attributes_set |= io.out.file_attr;
}
}
}
CHECK_EQUAL(file_attributes, 0xffff8048);
CHECK_EQUAL(denied_mask, 0x4000);
+ CHECK_EQUAL(file_attributes_set, 0x00001127);
smb2_deltree(tree, FNAME);
@@ -177,6 +182,20 @@ static bool test_create_gentest(struct torture_context *torture, struct smb2_tre
status = smb2_create(tree, tmp_ctx, &io);
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ io.in.fname = FNAME;
+ io.in.file_attributes = 0;
+ io.in.desired_access = SEC_FILE_READ_DATA | SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA;
+ io.in.query_maximal_access = true;
+ status = smb2_create(tree, tmp_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_EQUAL(io.out.maximal_access, 0x001f01ff);
+
+ q.access_information.level = RAW_FILEINFO_ACCESS_INFORMATION;
+ q.access_information.in.file.handle = io.out.file.handle;
+ status = smb2_getinfo_file(tree, tmp_ctx, &q);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_EQUAL(q.access_information.out.access_flags, io.in.desired_access);
+
talloc_free(tmp_ctx);
smb2_deltree(tree, FNAME);
@@ -237,6 +256,7 @@ static bool test_create_blob(struct torture_context *torture, struct smb2_tree *
io.in.query_maximal_access = true;
status = smb2_create(tree, tmp_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_EQUAL(io.out.maximal_access, 0x001f01ff);
status = smb2_util_close(tree, io.out.file.handle);
CHECK_STATUS(status, NT_STATUS_OK);