From 95afe46a0ec550253255f963bc0afe89cf0444ad Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 27 May 2008 14:07:27 +1000 Subject: expanded the SMB2 create testing (This used to be commit 71915128498674d9937780b9278fd2ac1eb06ba8) --- source4/torture/smb2/create.c | 74 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'source4/torture/smb2/create.c') diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c index fba7b8464f..0d8e4aefec 100644 --- a/source4/torture/smb2/create.c +++ b/source4/torture/smb2/create.c @@ -36,6 +36,13 @@ return false; \ }} while (0) +#define CHECK_EQUAL(v, correct) do { \ + if (v != correct) { \ + printf("(%s) Incorrect value for %s 0x%08x - should be 0x%08x\n", \ + __location__, #v, v, correct); \ + return false; \ + }} while (0) + /* test some interesting combinations found by gentest */ @@ -44,6 +51,7 @@ bool torture_smb2_create_gentest(struct torture_context *torture, struct smb2_tr struct smb2_create io; NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(tree); + uint32_t access_mask, file_attributes; ZERO_STRUCT(io); io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED; @@ -74,6 +82,72 @@ bool torture_smb2_create_gentest(struct torture_context *torture, struct smb2_tr status = smb2_create(tree, tmp_ctx, &io); CHECK_STATUS(status, NT_STATUS_NOT_SUPPORTED); + io.in.create_options = 0; + + io.in.file_attributes = FILE_ATTRIBUTE_DEVICE; + status = smb2_create(tree, tmp_ctx, &io); + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + + io.in.file_attributes = FILE_ATTRIBUTE_VOLUME; + status = smb2_create(tree, tmp_ctx, &io); + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + + io.in.create_disposition = NTCREATEX_DISP_OPEN; + io.in.file_attributes = FILE_ATTRIBUTE_VOLUME; + status = smb2_create(tree, tmp_ctx, &io); + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + + io.in.create_disposition = NTCREATEX_DISP_CREATE; + io.in.desired_access = 0x08000000; + status = smb2_create(tree, tmp_ctx, &io); + CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + + io.in.desired_access = 0x04000000; + status = smb2_create(tree, tmp_ctx, &io); + CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + + io.in.create_disposition = NTCREATEX_DISP_OPEN_IF; + io.in.file_attributes = 0; + access_mask = 0; + { + int i; + for (i=0;i<32;i++) { + io.in.desired_access = 1<