Clean up some CHECK_STATUS patches
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Wed Jun 24 23:50:56 MDT 2015
On 19/06/15 22:10, Michael Adam wrote:
>> I sugget using torture_assert_ntstatus_equal_goto().
>>
>> This is more writing than CHECK...(), but it is the
>> standard way. Could you do that instead?
While emacs and me remembered how to do it, we went through the rest of
the files in the source4/torture/smb2 directory and converted their
CHECK_STATUS macros. I left out source4/torture/smb2/lock.c, whose
CHECK_* macros are already defined in terms of torture_assert_*.
cheers,
Douglas
-------------- next part --------------
>From 2028e48af12b181d95a441c70634816354c2b5f4 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:17:28 +1200
Subject: [PATCH 01/14] Replace CHECK_STATUS macro in util.c
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/util.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 814e398..ffd5b95 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -559,14 +559,6 @@ bool smb2_util_setup_dir(struct torture_context *tctx, struct smb2_tree *tree,
return true;
}
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
/*
* Helper function to verify a security descriptor, by querying
* and comparing against the passed in sd.
@@ -585,7 +577,8 @@ bool smb2_util_verify_sd(TALLOC_CTX *tctx, struct smb2_tree *tree,
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!security_acl_equal(
q.query_secdesc.out.sd->dacl, sd->dacl)) {
@@ -617,7 +610,8 @@ bool smb2_util_verify_attrib(TALLOC_CTX *tctx, struct smb2_tree *tree,
q.standard.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
q.standard.in.file.handle = handle;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
q.all_info2.out.attrib &= ~(FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NONINDEXED);
--
1.9.1
>From a61aa652301037979c31e12fedf9f24b9eb8d55a Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:26:39 +1200
Subject: [PATCH 02/14] Replace CHECK_STATUS macro in streams.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/streams.c | 317 ++++++++++++++++++++++++++++-------------
1 file changed, 217 insertions(+), 100 deletions(-)
diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c
index 2db893c..9dd9d7b 100644
--- a/source4/torture/smb2/streams.c
+++ b/source4/torture/smb2/streams.c
@@ -32,15 +32,6 @@
#define DNAME "teststreams"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, \
- "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
torture_result(tctx, TORTURE_FAIL, \
@@ -238,7 +229,8 @@ static bool test_stream_dir(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
basedir_data = talloc_asprintf(mem_ctx, "%s::$DATA", DNAME);
sname1 = talloc_asprintf(mem_ctx, "%s:%s", fname, "Stream One");
@@ -258,7 +250,9 @@ static bool test_stream_dir(struct torture_context *tctx,
io.smb2.in.fname = sname1;
io.smb2.in.create_flags = 0;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_NOT_A_DIRECTORY,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) opening basedir stream\n", __location__);
ZERO_STRUCT(io.smb2);
@@ -273,7 +267,9 @@ static bool test_stream_dir(struct torture_context *tctx,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = basedir_data;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_NOT_A_DIRECTORY,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) opening basedir ::$DATA stream\n",
__location__);
@@ -289,7 +285,9 @@ static bool test_stream_dir(struct torture_context *tctx,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = basedir_data;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_FILE_IS_A_DIRECTORY,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) list the streams on the basedir\n",
__location__);
@@ -326,7 +324,8 @@ static bool test_stream_io(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) creating a stream on a non-existent file\n",
__location__);
@@ -343,7 +342,8 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
ret &= check_stream(tree, __location__, mem_ctx, fname,
@@ -353,12 +353,14 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.fname = fname;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, io.smb2.out.file.handle);
torture_comment(tctx, "(%s) writing to stream\n", __location__);
status = smb2_util_write(tree, h2, "test data", 0, 9);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h2);
@@ -368,12 +370,14 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
torture_comment(tctx, "(%s) modifying stream\n", __location__);
status = smb2_util_write(tree, h2, "MORE DATA ", 5, 10);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h2);
@@ -385,12 +389,14 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.fname = sname2;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
torture_comment(tctx, "(%s) modifying stream\n", __location__);
status= smb2_util_write(tree, h2, "SECOND STREAM", 0, 13);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h2);
ret &= check_stream(tree, __location__, mem_ctx, fname,
@@ -419,7 +425,8 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.fname = sname2;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
check_stream_list(tree, tctx, fname, 3, three, h2);
@@ -427,12 +434,14 @@ static bool test_stream_io(struct torture_context *tctx,
torture_comment(tctx, "(%s) deleting stream\n", __location__);
status = smb2_util_unlink(tree, sname1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io.smb2.in.fname = sname2;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
check_stream_list(tree, tctx, fname, 2, two, h2);
smb2_util_close(tree, h2);
@@ -446,12 +455,15 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
smb2_util_close(tree, h2);
status = smb2_util_unlink(tree, sname2);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
io.smb2.in.fname = fname;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
@@ -464,15 +476,21 @@ static bool test_stream_io(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
smb2_util_close(tree, io.ntcreatex.out.file.handle);
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
smb2_util_close(tree, io.ntcreatex.out.file.handle);
torture_comment(tctx, "(%s) deleting file\n", __location__);
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
@@ -506,7 +524,8 @@ static bool test_stream_sharemodes(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) Testing stream share mode conflicts\n",
__location__);
@@ -524,7 +543,8 @@ static bool test_stream_sharemodes(struct torture_context *tctx,
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/*
@@ -533,7 +553,8 @@ static bool test_stream_sharemodes(struct torture_context *tctx,
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
/*
@@ -544,11 +565,15 @@ static bool test_stream_sharemodes(struct torture_context *tctx,
io.smb2.in.fname = sname1;
io.smb2.in.create_disposition = 0;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
done:
smb2_util_close(tree, h1);
@@ -614,7 +639,8 @@ static bool test_stream_delete(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) opening non-existent file stream\n",
__location__);
@@ -631,11 +657,13 @@ static bool test_stream_delete(struct torture_context *tctx,
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
status = smb2_util_write(tree, h1, "test data", 0, 9);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* One stream opened without FILE_SHARE_DELETE prevents the main file
@@ -643,13 +671,17 @@ static bool test_stream_delete(struct torture_context *tctx,
*/
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.fname = fname;
io.smb2.in.desired_access = SEC_STD_DELETE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h1);
@@ -663,11 +695,13 @@ static bool test_stream_delete(struct torture_context *tctx,
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* file access still works on the stream while the main file is closed
@@ -678,7 +712,8 @@ static bool test_stream_delete(struct torture_context *tctx,
r.in.offset = 0;
status = smb2_read(tree, tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* name-based access to both the main file and the stream does not
@@ -688,7 +723,9 @@ static bool test_stream_delete(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.fname = fname;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_DELETE_PENDING,
+ ret, done, "Status is wrong");
/*
* older S3 doesn't do this
@@ -696,7 +733,9 @@ static bool test_stream_delete(struct torture_context *tctx,
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_DELETE_PENDING,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h1);
ZERO_STRUCT(h1);
@@ -708,7 +747,9 @@ static bool test_stream_delete(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.fname = fname;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
done:
if (!smb2_util_handle_empty(h1)) {
@@ -778,7 +819,8 @@ static bool test_stream_names(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) testing stream names\n", __location__);
ZERO_STRUCT(io.smb2);
@@ -794,7 +836,8 @@ static bool test_stream_names(struct torture_context *tctx,
io.smb2.in.fname = sname1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/*
@@ -804,7 +847,8 @@ static bool test_stream_names(struct torture_context *tctx,
io.smb2.in.fname = sname2;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
/*
@@ -815,47 +859,65 @@ static bool test_stream_names(struct torture_context *tctx,
io.smb2.in.fname = sname1;
io.smb2.in.create_disposition = NTCREATEX_DISP_SUPERSEDE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
io.smb2.in.fname = sname1b;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_INVALID,
+ ret, done, "Status is wrong");
io.smb2.in.fname = sname1c;
status = smb2_create(tree, mem_ctx, &(io.smb2));
if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
/* w2k returns INVALID_PARAMETER */
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_INVALID,
+ ret, done, "Status is wrong");
}
io.smb2.in.fname = sname1d;
status = smb2_create(tree, mem_ctx, &(io.smb2));
if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
/* w2k returns INVALID_PARAMETER */
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_INVALID,
+ ret, done, "Status is wrong");
}
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
io.smb2.in.fname = snamew;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io.smb2.out.file.handle;
io.smb2.in.fname = snamew2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_INVALID,
+ ret, done, "Status is wrong");
io.smb2.in.fname = fname;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret &= check_stream_list(tree, tctx, fname, 4, four,
io.smb2.out.file.handle);
@@ -870,7 +932,8 @@ static bool test_stream_names(struct torture_context *tctx,
finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
finfo.generic.in.file.handle = io.smb2.out.file.handle;
status = smb2_getinfo_file(tree, mem_ctx, &finfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret &= check_stream_list(tree, tctx, fname, 4, four,
io.smb2.out.file.handle);
@@ -897,18 +960,24 @@ static bool test_stream_names(struct torture_context *tctx,
SEC_RIGHTS_FILE_ALL;
io.smb2.in.fname = path;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h1 = io.smb2.out.file.handle;
finfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
finfo.generic.in.file.path = fname;
status = smb2_getinfo_file(tree, mem_ctx, &finfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
stinfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
stinfo.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree, mem_ctx, &stinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
if (!torture_setting_bool(tctx, "samba3", false)) {
CHECK_NTTIME(stinfo.all_info.out.create_time,
finfo.all_info.out.create_time);
@@ -933,7 +1002,9 @@ static bool test_stream_names(struct torture_context *tctx,
stinfo.generic.level = RAW_FILEINFO_NAME_INFORMATION;
stinfo.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree, mem_ctx, &stinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
if (!torture_setting_bool(tctx, "samba3", false)) {
CHECK_STR(rpath, stinfo.name_info.out.fname.s);
}
@@ -949,7 +1020,9 @@ static bool test_stream_names(struct torture_context *tctx,
sinfo.basic_info.in.write_time = write_time;
sinfo.basic_info.in.attrib = stinfo.all_info.out.attrib;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
stream_size = i*8192;
@@ -959,12 +1032,15 @@ static bool test_stream_names(struct torture_context *tctx,
sinfo.end_of_file_info.in.file.handle = h1;
sinfo.end_of_file_info.in.size = stream_size;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
stinfo.generic.level = RAW_FILEINFO_ALL_INFORMATION;
stinfo.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree, mem_ctx, &stinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!torture_setting_bool(tctx, "samba3", false)) {
CHECK_NTTIME(stinfo.all_info.out.write_time,
write_time);
@@ -983,7 +1059,9 @@ static bool test_stream_names(struct torture_context *tctx,
io.smb2.in.fname = fname;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
ret &= check_stream_list(tree, tctx, fname, 4, four,
io.smb2.out.file.handle);
@@ -998,7 +1076,8 @@ static bool test_stream_names(struct torture_context *tctx,
SEC_RIGHTS_FILE_ALL;
io.smb2.in.fname = snamer1;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
ret &= check_stream_list(tree,tctx, fname, 5, five1,
io.smb2.out.file.handle);
@@ -1010,7 +1089,8 @@ static bool test_stream_names(struct torture_context *tctx,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = ":AfterRename:$DATA";
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret &= check_stream_list(tree,tctx, fname, 5, five2,
io.smb2.out.file.handle);
@@ -1022,7 +1102,9 @@ static bool test_stream_names(struct torture_context *tctx,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = ":MStream Two:$DATA";
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_COLLISION,
+ ret, done, "Status is wrong");
ret &= check_stream_list(tree,tctx, fname, 5, five2,
io.smb2.out.file.handle);
@@ -1034,7 +1116,9 @@ static bool test_stream_names(struct torture_context *tctx,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = ":MStream Two:$DATA";
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
ret &= check_stream_list(tree,tctx, fname, 5, five2,
io.smb2.out.file.handle);
@@ -1068,7 +1152,8 @@ static bool test_stream_names2(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) testing stream names\n", __location__);
ZERO_STRUCT(io.smb2);
@@ -1083,7 +1168,8 @@ static bool test_stream_names2(struct torture_context *tctx,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = fname;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
for (i=0x01; i < 0x7F; i++) {
@@ -1113,7 +1199,9 @@ static bool test_stream_names2(struct torture_context *tctx,
isprint(i)?"":" (not printable)",
nt_errstr(expected));
}
- CHECK_STATUS(status, expected);
+ torture_assert_ntstatus_equal_goto(tctx, status, expected,
+ ret, done,
+ "Status is wrong");
talloc_free(path);
}
@@ -1172,7 +1260,8 @@ static bool test_stream_rename(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "(%s) testing stream renames\n", __location__);
ZERO_STRUCT(io.smb2);
@@ -1193,13 +1282,15 @@ static bool test_stream_rename(struct torture_context *tctx,
/* Create two streams. */
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
smb2_util_close(tree, h1);
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
smb2_util_close(tree, h1);
@@ -1210,7 +1301,8 @@ static bool test_stream_rename(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/*
@@ -1257,7 +1349,8 @@ static bool test_stream_rename2(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io.smb2);
io.smb2.in.create_flags = 0;
@@ -1279,7 +1372,8 @@ static bool test_stream_rename2(struct torture_context *tctx,
/* Open/create new stream. */
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, io.smb2.out.file.handle);
@@ -1289,7 +1383,8 @@ static bool test_stream_rename2(struct torture_context *tctx,
io.smb2.in.fname = sname1;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/*
@@ -1304,7 +1399,8 @@ static bool test_stream_rename2(struct torture_context *tctx,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = stream_name1;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* Check SMB2 rename of an overwriting stream using :<stream>.
@@ -1316,14 +1412,16 @@ static bool test_stream_rename2(struct torture_context *tctx,
io.smb2.in.fname = sname2;
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, io.smb2.out.file.handle);
/* Rename the first stream onto the second. */
sinfo.rename_information.in.file.handle = h1;
sinfo.rename_information.in.new_name = stream_name2;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h1);
@@ -1333,7 +1431,8 @@ static bool test_stream_rename2(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.fname = sname2;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/*
@@ -1344,7 +1443,9 @@ static bool test_stream_rename2(struct torture_context *tctx,
sinfo.rename_information.in.file.handle = h1;
sinfo.rename_information.in.new_name = sname1;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
if (!torture_setting_bool(tctx, "samba4", false)) {
/*
@@ -1355,7 +1456,9 @@ static bool test_stream_rename2(struct torture_context *tctx,
sinfo.rename_information.in.file.handle = h1;
sinfo.rename_information.in.new_name = stream_name_default;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
smb2_util_close(tree, h1);
@@ -1397,7 +1500,8 @@ static bool create_file_with_stream(struct torture_context *tctx,
io.smb2.in.fname = stream;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
smb2_util_close(tree, io.smb2.out.file.handle);
@@ -1426,7 +1530,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fname_stream = talloc_asprintf(mem_ctx, "%s:%s", fname, stream);
@@ -1460,7 +1565,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
__location__);
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!check_stream_list(tree, tctx, fname, 2, stream_list,
io.smb2.out.file.handle)) {
goto done;
@@ -1474,7 +1580,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
__location__);
io.smb2.in.create_disposition = NTCREATEX_DISP_OVERWRITE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!check_stream_list(tree, tctx, fname, 1, &default_stream_name,
io.smb2.out.file.handle)) {
goto done;
@@ -1492,7 +1599,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!check_stream_list(tree, tctx, fname, 1, &default_stream_name,
io.smb2.out.file.handle)) {
goto done;
@@ -1512,7 +1620,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_SUPERSEDE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!check_stream_list(tree, tctx, fname, 1, &default_stream_name,
io.smb2.out.file.handle)) {
goto done;
@@ -1533,7 +1642,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OVERWRITE_IF;
io.smb2.in.fname = fname_stream;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (!check_stream_list(tree, tctx, fname, 2, stream_list,
io.smb2.out.file.handle)) {
goto done;
@@ -1606,7 +1716,8 @@ static bool test_stream_attributes(struct torture_context *tctx,
smb2_deltree(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fname_stream = talloc_asprintf(mem_ctx, "%s:%s", fname, stream);
@@ -1625,13 +1736,15 @@ static bool test_stream_attributes(struct torture_context *tctx,
NTCREATEX_SHARE_ACCESS_WRITE |
NTCREATEX_SHARE_ACCESS_DELETE;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(finfo);
finfo.generic.level = RAW_FILEINFO_BASIC_INFORMATION;
finfo.generic.in.file.handle = io.smb2.out.file.handle;
status = smb2_getinfo_file(tree, mem_ctx, &finfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (finfo.basic_info.out.attrib != FILE_ATTRIBUTE_ARCHIVE) {
torture_comment(tctx, "(%s) Incorrect attrib %x - should be "
@@ -1670,7 +1783,8 @@ static bool test_stream_attributes(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
ZERO_STRUCT(finfo);
@@ -1717,14 +1831,17 @@ static bool test_stream_attributes(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, mem_ctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
ZERO_STRUCT(finfo);
finfo.generic.level = RAW_FILEINFO_BASIC_INFORMATION;
finfo.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree, mem_ctx, &finfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
done:
smb2_util_close(tree, h1);
--
1.9.1
>From 1f7bbec32f8d4880c4098cb1057d59923e5eaf47 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:27:09 +1200
Subject: [PATCH 03/14] Replace CHECK_STATUS macro in setinfo.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/setinfo.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c
index fee7293..148b42e 100644
--- a/source4/torture/smb2/setinfo.c
+++ b/source4/torture/smb2/setinfo.c
@@ -166,14 +166,6 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
goto done; \
}} while (0)
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
torture_smb2_all_info(tree, handle);
torture_comment(tctx, "Test basic_information level\n");
@@ -288,7 +280,8 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
ace.access_mask = SEC_STD_ALL;
ace.trustee = *test_sid;
status = security_descriptor_dacl_add(sd, &ace);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "add a new ACE to the DACL\n");
@@ -300,7 +293,8 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
torture_comment(tctx, "remove it again\n");
status = security_descriptor_dacl_del(sd, test_sid);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sfinfo.set_secdesc.in.secinfo_flags = finfo2.query_secdesc.in.secinfo_flags;
sfinfo.set_secdesc.in.sd = sd;
--
1.9.1
>From f8f7b7c4de9b056a95f128d713a8720aa83c4e73 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:31:14 +1200
Subject: [PATCH 04/14] Replace CHECK_STATUS macro in session.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/session.c | 207 +++++++++++++++++++++++++++--------------
1 file changed, 136 insertions(+), 71 deletions(-)
diff --git a/source4/torture/smb2/session.c b/source4/torture/smb2/session.c
index 798230b..889e1ed 100644
--- a/source4/torture/smb2/session.c
+++ b/source4/torture/smb2/session.c
@@ -38,14 +38,6 @@
ret = false; \
}} while (0)
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
- nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_CREATED(__io, __created, __attribute) \
do { \
CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
@@ -85,7 +77,8 @@ bool test_session_reconnect1(struct torture_context *tctx, struct smb2_tree *tre
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -105,7 +98,9 @@ bool test_session_reconnect1(struct torture_context *tctx, struct smb2_tree *tre
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
h1 = NULL;
smb2_oplock_create_share(&io2, fname,
@@ -113,7 +108,8 @@ bool test_session_reconnect1(struct torture_context *tctx, struct smb2_tree *tre
smb2_util_oplock_level("b"));
status = smb2_create(tree2, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
_h2 = io2.out.file.handle;
@@ -168,7 +164,8 @@ bool test_session_reconnect2(struct torture_context *tctx, struct smb2_tree *tre
io1.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -187,7 +184,9 @@ bool test_session_reconnect2(struct torture_context *tctx, struct smb2_tree *tre
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
h1 = NULL;
done:
@@ -225,7 +224,8 @@ bool test_session_reauth1(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -234,7 +234,8 @@ bool test_session_reauth1(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -242,12 +243,14 @@ bool test_session_reauth1(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -255,7 +258,8 @@ bool test_session_reauth1(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
if (h1 != NULL) {
@@ -294,7 +298,8 @@ bool test_session_reauth2(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -308,7 +313,8 @@ bool test_session_reauth2(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
anon_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -316,14 +322,16 @@ bool test_session_reauth2(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -331,7 +339,8 @@ bool test_session_reauth2(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
qfinfo.generic.in.file.handle = _h1;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
if (h1 != NULL) {
@@ -378,7 +387,8 @@ bool test_session_reauth3(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -393,7 +403,8 @@ bool test_session_reauth3(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-authenticate as anonymous */
anon_creds = cli_credentials_init_anon(mem_ctx);
@@ -402,7 +413,8 @@ bool test_session_reauth3(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
anon_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -413,14 +425,16 @@ bool test_session_reauth3(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to access the file via the old handle */
@@ -431,7 +445,8 @@ bool test_session_reauth3(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
if (h1 != NULL) {
@@ -482,7 +497,8 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -497,7 +513,8 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd1 = qfinfo.query_secdesc.out.sd;
@@ -509,7 +526,8 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
anon_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* give full access on the file to anonymous */
@@ -522,7 +540,8 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
ace.trustee = *extra_sid;
status = security_descriptor_dacl_add(sd1, &ace);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sfinfo);
sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
@@ -531,14 +550,16 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.set_secdesc.in.sd = sd1;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-get the security descriptor */
@@ -549,7 +570,8 @@ bool test_session_reauth4(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret = true;
@@ -607,7 +629,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
CHECK_VAL(ok, true);
status = torture_smb2_testdir(tree, dname, &_dh1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh1 = &_dh1;
smb2_oplock_create_share(&io1, fname,
@@ -615,7 +638,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -630,7 +654,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
f_sd1 = qfinfo.query_secdesc.out.sd;
@@ -642,7 +667,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
anon_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to rename the file: fails */
@@ -657,14 +683,17 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.rename_information.in.new_name = fname2;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* give full access on the file to anonymous */
@@ -677,7 +706,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
ace.trustee = *extra_sid;
status = security_descriptor_dacl_add(f_sd1, &ace);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sfinfo);
sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
@@ -686,7 +716,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.set_secdesc.in.sd = f_sd1;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-get the security descriptor */
@@ -697,7 +728,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* re-authenticate as anonymous - again */
@@ -707,7 +739,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
anon_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* try to rename the file: fails */
@@ -718,7 +751,9 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.rename_information.in.new_name = fname2;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
/* give full access on the parent dir to anonymous */
@@ -729,7 +764,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
d_sd1 = qfinfo.query_secdesc.out.sd;
@@ -740,7 +776,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
ace.trustee = *extra_sid;
status = security_descriptor_dacl_add(d_sd1, &ace);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sfinfo);
sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
@@ -750,7 +787,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.set_secdesc.in.sd = d_sd1;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(qfinfo);
@@ -759,7 +797,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, _dh1);
dh1 = NULL;
@@ -773,14 +812,17 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.rename_information.in.new_name = fname2;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
/* re-authenticate as original user - again */
status = smb2_session_setup_spnego(tree->session,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* rename the file - for verification that it works */
@@ -791,7 +833,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.rename_information.in.new_name = fname2;
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* closs the file, check it is gone and reopen under the new name */
@@ -808,7 +851,9 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
0 /* leasekey */, 0 /* leasestate */);
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io1);
@@ -821,7 +866,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
0 /* leasekey */, 0 /* leasestate */);
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
@@ -836,7 +882,8 @@ bool test_session_reauth5(struct torture_context *tctx, struct smb2_tree *tree)
qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
if (dh1 != NULL) {
@@ -896,7 +943,8 @@ bool test_session_reauth6(struct torture_context *tctx, struct smb2_tree *tree)
io1.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -922,7 +970,9 @@ bool test_session_reauth6(struct torture_context *tctx, struct smb2_tree *tree)
status = smb2_session_setup_spnego(tree->session,
broken_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_LOGON_FAILURE,
+ ret, done, "Status is wrong");
torture_comment(tctx, "did failed reauth\n");
/*
@@ -940,7 +990,8 @@ bool test_session_reauth6(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_oplock_level("b"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, expected);
+ torture_assert_ntstatus_equal_goto(tctx, status, expected,
+ ret, done, "Status is wrong");
done:
if (h1 != NULL) {
@@ -1014,7 +1065,8 @@ static bool test_session_expire1(struct torture_context *tctx)
io1.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
status = smb2_create(tree, tctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1032,7 +1084,9 @@ static bool test_session_expire1(struct torture_context *tctx)
ZERO_STRUCT(qfinfo.access_information.out);
status = smb2_getinfo_file(tree, tctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
torture_comment(tctx, "sleep 5 seconds\n");
smb_msleep(5*1000);
@@ -1040,7 +1094,9 @@ static bool test_session_expire1(struct torture_context *tctx)
torture_comment(tctx, "query info => EXPIRED\n");
ZERO_STRUCT(qfinfo.access_information.out);
status = smb2_getinfo_file(tree, tctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_NETWORK_SESSION_EXPIRED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_NETWORK_SESSION_EXPIRED,
+ ret, done, "Status is wrong");
/*
* the krb5 library may not handle expired creds
@@ -1052,12 +1108,15 @@ static bool test_session_expire1(struct torture_context *tctx)
status = smb2_session_setup_spnego(tree->session,
credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
ZERO_STRUCT(qfinfo.access_information.out);
status = smb2_getinfo_file(tree, tctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret = true;
done:
@@ -1108,7 +1167,8 @@ bool test_session_bind1(struct torture_context *tctx, struct smb2_tree *tree1)
smb2_util_oplock_level("b"));
status = smb2_create(tree1, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1143,7 +1203,8 @@ bool test_session_bind1(struct torture_context *tctx, struct smb2_tree *tree1)
status = smb2_session_setup_spnego(session1_2,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* use the 1st connection, 1st session */
ZERO_STRUCT(qfinfo);
@@ -1151,7 +1212,8 @@ bool test_session_bind1(struct torture_context *tctx, struct smb2_tree *tree1)
qfinfo.generic.in.file.handle = _h1;
tree1->session = session1_1;
status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* use the 2nd connection, 1st session */
ZERO_STRUCT(qfinfo);
@@ -1159,7 +1221,8 @@ bool test_session_bind1(struct torture_context *tctx, struct smb2_tree *tree1)
qfinfo.generic.in.file.handle = _h1;
tree1->session = session1_2;
status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
tree1->session = session1_1;
smb2_util_close(tree1, *h1);
@@ -1177,11 +1240,13 @@ bool test_session_bind1(struct torture_context *tctx, struct smb2_tree *tree1)
status = smb2_session_setup_spnego(session2_1,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
tree2->session = session2_1;
status = smb2_util_unlink(tree2, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret = true;
done:
--
1.9.1
>From 1e448d5dd69de29ca18429065f9f52c97303c00b Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:33:03 +1200
Subject: [PATCH 05/14] Replace CHECK_STATUS macro in replay.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/replay.c | 115 +++++++++++++++++++++++++++---------------
1 file changed, 73 insertions(+), 42 deletions(-)
diff --git a/source4/torture/smb2/replay.c b/source4/torture/smb2/replay.c
index e4f5b01..012a437 100644
--- a/source4/torture/smb2/replay.c
+++ b/source4/torture/smb2/replay.c
@@ -41,14 +41,6 @@
goto done; \
}} while (0)
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
- nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_CREATED(__io, __created, __attribute) \
do { \
CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
@@ -189,7 +181,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
tree->session->transport->oplock.private_data = tree;
status = torture_smb2_testdir(tree, BASEDIR, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h);
smb2cli_session_start_replay(tree->session->smbXcli);
@@ -198,7 +191,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
torture_comment(tctx, "Trying create\n");
status = torture_smb2_testfile(tree, fname, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 0);
/*
* Wireshark shows that the response has SMB2_FLAGS_REPLAY_OPERATION
@@ -207,14 +201,16 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
torture_comment(tctx, "Trying write\n");
status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
f = (struct smb2_flush) {
.in.file.handle = h
};
torture_comment(tctx, "Trying flush\n");
status = smb2_flush(tree, &f);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
rd = (struct smb2_read) {
.in.file.handle = h,
@@ -224,7 +220,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
};
torture_comment(tctx, "Trying read\n");
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(rd.out.data.length, 10);
sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
@@ -232,7 +229,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
sfinfo.position_information.in.position = 0x1000;
torture_comment(tctx, "Trying setinfo\n");
status = smb2_setinfo_file(tree, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
qfinfo = (union smb_fileinfo) {
.generic.level = RAW_SFILEINFO_POSITION_INFORMATION,
@@ -240,7 +238,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
};
torture_comment(tctx, "Trying getinfo\n");
status = smb2_getinfo_file(tree, tmp_ctx, &qfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(qfinfo.position_information.out.position, 0x1000);
ioctl = (union smb_ioctl) {
@@ -252,7 +251,8 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
};
torture_comment(tctx, "Trying ioctl\n");
status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
lck = (struct smb2_lock) {
.in.locks = el,
@@ -268,12 +268,14 @@ static bool test_replay1(struct torture_context *tctx, struct smb2_tree *tree)
el[0].offset = 0x0000000000000000;
el[0].length = 0x0000000000000100;
status = smb2_lock(tree, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
lck.in.file.handle = h;
el[0].flags = SMB2_LOCK_FLAG_UNLOCK;
status = smb2_lock(tree, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 0);
done:
@@ -317,7 +319,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
"Channel\n");
smb2_util_unlink(tree, fname);
status = torture_smb2_testdir(tree, BASEDIR, &_h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, _h);
CHECK_VAL(break_info.count, 0);
@@ -331,7 +334,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ref1 = io;
_h = io.out.file.handle;
h = &_h;
@@ -347,7 +351,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
smb2cli_session_start_replay(tree->session->smbXcli);
status = smb2_create(tree, mem_ctx, &io);
smb2cli_session_stop_replay(tree->session->smbXcli);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATE_OUT(&io, &ref1);
CHECK_VAL(break_info.count, 0);
@@ -380,7 +385,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
smb2cli_session_start_replay(tree->session->smbXcli);
status = smb2_create(tree, mem_ctx, &io);
smb2cli_session_stop_replay(tree->session->smbXcli);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATE_OUT(&io, &ref2);
CHECK_VAL(break_info.count, 0);
@@ -391,7 +397,9 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
io = ref1;
io.in.durable_open_v2 = false;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 1);
CHECK_HANDLE(&break_info.handle, &ref1.out.file.handle);
CHECK_VAL(break_info.level, smb2_util_oplock_level("s"));
@@ -400,7 +408,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
smb2_util_close(tree, *h);
h = NULL;
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 0);
/*
@@ -421,7 +430,8 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
};
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 0);
_h = io.out.file.handle;
h = &_h;
@@ -433,7 +443,9 @@ static bool test_replay2(struct torture_context *tctx, struct smb2_tree *tree)
*/
smb2cli_session_start_replay(tree->session->smbXcli);
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_COLLISION,
+ ret, done, "Status is wrong");
CHECK_VAL(break_info.count, 0);
done:
@@ -485,7 +497,8 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1)
torture_comment(tctx, "Replay of DurableHandleReqV2 on Multi "
"Channel\n");
status = torture_smb2_testdir(tree1, BASEDIR, &_h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree1, _h);
smb2_util_unlink(tree1, fname);
CHECK_VAL(break_info.count, 0);
@@ -504,7 +517,8 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1)
tree1->session = session1_1;
status = smb2_create(tree1, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -544,7 +558,8 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1)
status = smb2_session_setup_spnego(session1_2,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* use the 2nd channel, 1st session
@@ -553,7 +568,8 @@ static bool test_replay3(struct torture_context *tctx, struct smb2_tree *tree1)
smb2cli_session_start_replay(tree1->session->smbXcli);
status = smb2_create(tree1, mem_ctx, &io);
smb2cli_session_stop_replay(tree1->session->smbXcli);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -622,7 +638,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
torture_comment(tctx, "IO Ordering for Multi Channel\n");
status = torture_smb2_testdir(tree1, BASEDIR, &_h1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree1, _h1);
smb2_util_unlink(tree1, fname);
CHECK_VAL(break_info.count, 0);
@@ -642,7 +659,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
tree1->session = session1_1;
status = smb2_create(tree1, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -653,7 +671,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
CHECK_VAL(break_info.count, 0);
status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* Increment ChannelSequence so that server thinks that there's a
@@ -670,7 +689,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
.in.offset = 0
};
status = smb2_read(tree1, tree1, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* Performing a Write with Stale ChannelSequence is not allowed by
@@ -679,7 +699,9 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
curr_cs = smb2cli_session_reset_channel_sequence(
tree1->session->smbXcli, 0);
status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_FILE_NOT_AVAILABLE);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_FILE_NOT_AVAILABLE,
+ ret, done, "Status is wrong");
/*
* Performing a Write Replay with Stale ChannelSequence is not allowed
@@ -689,7 +711,9 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
smb2cli_session_reset_channel_sequence(tree1->session->smbXcli, 0);
status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf));
smb2cli_session_stop_replay(tree1->session->smbXcli);
- CHECK_STATUS(status, NT_STATUS_FILE_NOT_AVAILABLE);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_FILE_NOT_AVAILABLE,
+ ret, done, "Status is wrong");
/*
* Performing a SetInfo with stale ChannelSequence is not allowed by
@@ -700,7 +724,9 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
sfinfo.generic.in.file.handle = *h1;
sfinfo.position_information.in.position = 0x1000;
status = smb2_setinfo_file(tree1, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_FILE_NOT_AVAILABLE);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_FILE_NOT_AVAILABLE,
+ ret, done, "Status is wrong");
/*
* Performing a Read with stale ChannelSequence is allowed
@@ -711,7 +737,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
.in.offset = 0
};
status = smb2_read(tree1, tree1, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_connect(tctx,
host,
@@ -743,7 +770,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
status = smb2_session_setup_spnego(session1_2,
cmdline_credentials,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* use the 2nd channel, 1st session
@@ -757,7 +785,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
smb2cli_session_reset_channel_sequence(tree1->session->smbXcli,
curr_cs);
status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2cli_session_stop_replay(tree1->session->smbXcli);
/*
@@ -767,7 +796,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
memset(buf, 'r', ARRAY_SIZE(buf));
smb2cli_session_start_replay(tree1->session->smbXcli);
status = smb2_util_write(tree1, *h1, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2cli_session_stop_replay(tree1->session->smbXcli);
/*
@@ -779,7 +809,8 @@ static bool test_replay4(struct torture_context *tctx, struct smb2_tree *tree1)
.in.offset = 0
};
status = smb2_read(tree1, tree1, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if ((rd.out.data.length != ARRAY_SIZE(buf)) ||
memcmp(rd.out.data.data, buf, ARRAY_SIZE(buf))) {
--
1.9.1
>From 6f19aec38ad7dc67ca5d6ec1d072a09379a0a228 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:35:12 +1200
Subject: [PATCH 06/14] Replace CHECK_STATUS macro in rename.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/rename.c | 143 +++++++++++++++++++++++++++---------------
1 file changed, 91 insertions(+), 52 deletions(-)
diff --git a/source4/torture/smb2/rename.c b/source4/torture/smb2/rename.c
index 07bdabd..07aec29 100644
--- a/source4/torture/smb2/rename.c
+++ b/source4/torture/smb2/rename.c
@@ -30,15 +30,6 @@
#include "librpc/gen_ndr/security.h"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(torture, TORTURE_FAIL, \
- "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define BASEDIR "test_rename"
/*
@@ -82,7 +73,8 @@ static bool torture_smb2_rename_simple(struct torture_context *torture,
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -95,7 +87,8 @@ static bool torture_smb2_rename_simple(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Checking for new filename\n");
@@ -103,7 +96,8 @@ static bool torture_smb2_rename_simple(struct torture_context *torture,
fi.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
fi.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree1, torture, &fi);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -112,7 +106,8 @@ static bool torture_smb2_rename_simple(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = h1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(h1);
@@ -170,7 +165,8 @@ static bool torture_smb2_rename_simple2(struct torture_context *torture,
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -183,7 +179,9 @@ static bool torture_smb2_rename_simple2(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -191,7 +189,8 @@ static bool torture_smb2_rename_simple2(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = h1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(h1);
@@ -250,7 +249,8 @@ static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -263,7 +263,8 @@ static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Checking for new filename\n");
@@ -271,7 +272,8 @@ static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
fi.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
fi.generic.in.file.handle = h1;
status = smb2_getinfo_file(tree1, torture, &fi);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -280,7 +282,8 @@ static bool torture_smb2_rename_no_sharemode(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = h1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(h1);
@@ -342,7 +345,8 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh = io.smb2.out.file.handle;
@@ -365,7 +369,8 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fh = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -378,7 +383,9 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -386,7 +393,8 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = fh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(fh);
@@ -396,7 +404,8 @@ static bool torture_smb2_rename_with_delete_access(struct torture_context *tortu
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = dh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(dh);
@@ -466,7 +475,8 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh = io.smb2.out.file.handle;
@@ -489,7 +499,8 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fh = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -502,7 +513,9 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -510,7 +523,8 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = fh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(fh);
@@ -520,7 +534,8 @@ static bool torture_smb2_rename_with_delete_access2(struct torture_context *tort
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = dh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(dh);
@@ -591,7 +606,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh = io.smb2.out.file.handle;
@@ -614,7 +630,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fh = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -627,7 +644,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Checking for new filename\n");
@@ -635,7 +653,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
fi.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
fi.generic.in.file.handle = fh;
status = smb2_getinfo_file(tree1, torture, &fi);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -644,7 +663,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = fh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(fh);
@@ -654,7 +674,8 @@ static bool torture_smb2_rename_no_delete_access(struct torture_context *torture
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = dh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(dh);
@@ -724,7 +745,8 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh = io.smb2.out.file.handle;
@@ -747,7 +769,8 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fh = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -760,7 +783,9 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -768,7 +793,8 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = fh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(fh);
@@ -778,7 +804,8 @@ static bool torture_smb2_rename_no_delete_access2(struct torture_context *tortur
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = dh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(dh);
@@ -843,7 +870,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
fh = io.smb2.out.file.handle;
torture_comment(torture, "Opening parent directory\n");
@@ -862,7 +890,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
dh = io.smb2.out.file.handle;
torture_comment(torture, "Renaming test file\n");
@@ -875,7 +904,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\newname.txt";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Checking for new filename\n");
@@ -883,7 +913,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
fi.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
fi.generic.in.file.handle = fh;
status = smb2_getinfo_file(tree1, torture, &fi);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing test file\n");
@@ -892,7 +923,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = fh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(fh);
@@ -902,7 +934,8 @@ static bool torture_smb2_rename_msword(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = dh;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(dh);
@@ -957,7 +990,8 @@ static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
d1 = io.smb2.out.file.handle;
torture_comment(torture, "Creating test file\n");
@@ -976,7 +1010,8 @@ static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
io.smb2.in.fname = BASEDIR "\\file.txt";
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
torture_comment(torture, "Renaming directory\n");
@@ -989,7 +1024,9 @@ static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "-new";
status = smb2_setinfo_file(tree1, &sinfo);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(torture, "Closing directory\n");
@@ -997,14 +1034,16 @@ static bool torture_smb2_rename_dir_openfile(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = d1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(d1);
torture_comment(torture, "Closing test file\n");
cl.smb2.in.file.handle = h1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(h1);
done:
--
1.9.1
>From 067c9b1f896fceabc34c645bdb678629e1480dd9 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:38:32 +1200
Subject: [PATCH 07/14] Replace CHECK_STATUS macro in read.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/read.c | 98 ++++++++++++++++++++++++++++++---------------
1 file changed, 65 insertions(+), 33 deletions(-)
diff --git a/source4/torture/smb2/read.c b/source4/torture/smb2/read.c
index 3600765..066b9ea 100644
--- a/source4/torture/smb2/read.c
+++ b/source4/torture/smb2/read.c
@@ -14,6 +14,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -27,14 +28,6 @@
#include "torture/smb2/proto.h"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- printf("(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
printf("(%s) Incorrect value %s=%u - should be %u\n", \
@@ -60,17 +53,21 @@ static bool test_read_eof(struct torture_context *torture, struct smb2_tree *tre
smb2_util_unlink(tree, FNAME);
status = torture_smb2_testfile(tree, FNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(rd);
rd.in.file.handle = h;
rd.in.length = 5;
rd.in.offset = 0;
status = smb2_read(tree, tree, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(rd);
rd.in.file.handle = h;
@@ -79,58 +76,73 @@ static bool test_read_eof(struct torture_context *torture, struct smb2_tree *tre
rd.in.min_count = 1;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VALUE(rd.out.data.length, 10);
rd.in.min_count = 0;
rd.in.length = 10;
rd.in.offset = sizeof(buf);
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
rd.in.min_count = 0;
rd.in.length = 0;
rd.in.offset = sizeof(buf);
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VALUE(rd.out.data.length, 0);
rd.in.min_count = 1;
rd.in.length = 0;
rd.in.offset = sizeof(buf);
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
rd.in.min_count = 0;
rd.in.length = 2;
rd.in.offset = sizeof(buf) - 1;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VALUE(rd.out.data.length, 1);
rd.in.min_count = 2;
rd.in.length = 1;
rd.in.offset = sizeof(buf) - 1;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
rd.in.min_count = 0x10000;
rd.in.length = 1;
rd.in.offset = 0;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
rd.in.min_count = 0x10000 - 2;
rd.in.length = 1;
rd.in.offset = 0;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
rd.in.min_count = 10;
rd.in.length = 5;
rd.in.offset = 0;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done, "Status is wrong");
done:
talloc_free(tmp_ctx);
@@ -151,10 +163,12 @@ static bool test_read_position(struct torture_context *torture, struct smb2_tree
ZERO_STRUCT(buf);
status = torture_smb2_testfile(tree, FNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(rd);
rd.in.file.handle = h;
@@ -163,21 +177,23 @@ static bool test_read_position(struct torture_context *torture, struct smb2_tree
rd.in.min_count = 1;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VALUE(rd.out.data.length, 10);
info.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
info.generic.in.file.handle = h;
status = smb2_getinfo_file(tree, tmp_ctx, &info);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
if (torture_setting_bool(torture, "windows", false)) {
CHECK_VALUE(info.all_info2.out.position, 0);
} else {
CHECK_VALUE(info.all_info2.out.position, 10);
}
-
+
done:
talloc_free(tmp_ctx);
return ret;
@@ -204,19 +220,29 @@ static bool test_read_dir(struct torture_context *torture, struct smb2_tree *tre
rd.in.min_count = 1;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_INVALID_DEVICE_REQUEST);
-
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_DEVICE_REQUEST,
+ ret, done, "Status is wrong");
+
rd.in.min_count = 11;
status = smb2_read(tree, tmp_ctx, &rd);
- CHECK_STATUS(status, NT_STATUS_INVALID_DEVICE_REQUEST);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_DEVICE_REQUEST,
+ ret, done, "Status is wrong");
rd.in.length = 0;
rd.in.min_count = 2592;
status = smb2_read(tree, tmp_ctx, &rd);
if (torture_setting_bool(torture, "windows", false)) {
- CHECK_STATUS(status, NT_STATUS_END_OF_FILE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_END_OF_FILE,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_INVALID_DEVICE_REQUEST);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_DEVICE_REQUEST,
+ ret, done,
+ "Status is wrong");
}
rd.in.length = 0;
@@ -224,11 +250,17 @@ static bool test_read_dir(struct torture_context *torture, struct smb2_tree *tre
rd.in.channel = 0;
status = smb2_read(tree, tmp_ctx, &rd);
if (torture_setting_bool(torture, "windows", false)) {
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_INVALID_DEVICE_REQUEST);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_DEVICE_REQUEST,
+ ret, done,
+ "Status is wrong");
}
-
+
done:
talloc_free(tmp_ctx);
return ret;
--
1.9.1
>From 2c9fa8200c06fcd8533666a8c99144cc3b0eb77c Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:49:27 +1200
Subject: [PATCH 08/14] Replace CHECK_STATUS macro in notify.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/notify.c | 423 ++++++++++++++++++++++++++++--------------
1 file changed, 287 insertions(+), 136 deletions(-)
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index b804ebc..a2c6201 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -42,15 +42,6 @@
#include "libcli/raw/raw_proto.h"
#include "libcli/libcli.h"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(torture, TORTURE_FAIL, \
- "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_VAL(v, correct) do { \
if ((v) != (correct)) { \
torture_result(torture, TORTURE_FAIL, \
@@ -94,7 +85,8 @@ static bool test_valid_request(struct torture_context *torture,
smb2_util_unlink(tree, FNAME);
status = smb2_util_roothandle(tree, &dh);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* 0x00080000 is the default max buffer size for Windows servers
* pre-Win7 */
@@ -115,10 +107,12 @@ static bool test_valid_request(struct torture_context *torture,
}
status = torture_setup_complex_file(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(n.out.num_changes, 1);
CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_ADDED);
CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
@@ -137,10 +131,13 @@ static bool test_valid_request(struct torture_context *torture,
}
status = torture_setup_complex_file(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_ENUM_DIR,
+ ret, done, "Status is wrong");
/*
* if the change response fits in the buffer we get
@@ -156,10 +153,12 @@ static bool test_valid_request(struct torture_context *torture,
}
status = torture_setup_complex_file(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(n.out.num_changes, 3);
CHECK_VAL(n.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
@@ -170,9 +169,11 @@ static bool test_valid_request(struct torture_context *torture,
/* if the first notify returns NOTIFY_ENUM_DIR, all do */
status = smb2_util_close(tree, dh);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_roothandle(tree, &dh);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
n.in.recursive = 0x0000;
n.in.buffer_size = 0x00000001;
@@ -188,10 +189,13 @@ static bool test_valid_request(struct torture_context *torture,
}
status = torture_setup_complex_file(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_ENUM_DIR,
+ ret, done, "Status is wrong");
n.in.buffer_size = max_buffer_size;
req = smb2_notify_send(tree, &n);
@@ -202,10 +206,13 @@ static bool test_valid_request(struct torture_context *torture,
}
status = torture_setup_complex_file(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_ENUM_DIR,
+ ret, done, "Status is wrong");
/* if the buffer size is too large, we get invalid parameter */
n.in.recursive = 0x0000;
@@ -215,7 +222,9 @@ static bool test_valid_request(struct torture_context *torture,
n.in.unknown = 0x00000000;
req = smb2_notify_send(tree, &n);
status = smb2_notify_recv(req, torture, &n);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
done:
return ret;
@@ -261,13 +270,15 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
io.smb2.in.desired_access = SEC_RIGHTS_FILE_READ;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -284,7 +295,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
req = smb2_notify_send(tree1, &(notify.smb2));
smb2_cancel(req);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
torture_comment(torture, "Testing notify mkdir\n");
@@ -292,7 +304,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
smb2_util_mkdir(tree2, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
@@ -304,7 +317,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
smb2_util_rmdir(tree2, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
@@ -319,7 +333,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
smb_msleep(200);
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 4);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
@@ -376,7 +391,9 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/* (1st unlink) as the 2nd notify directly returns,
this unlink is only seen by the 1st notify and
@@ -384,11 +401,13 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
torture_comment(torture,
"Testing notify on unlink for the first file\n");
status = smb2_util_unlink(tree2, BASEDIR "\\test0.txt");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* receive the reply from the 2nd notify */
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, count);
for (i=1;i<count;i++) {
@@ -399,7 +418,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
torture_comment(torture, "and now from the 1st notify\n");
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "test0.txt");
@@ -409,19 +429,25 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_util_unlink(tree1, BASEDIR "\\nonexistent.txt");
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
for (i=1;i<count;i++) {
char *fname2 = talloc_asprintf(torture,
BASEDIR "\\test%d.txt", i);
status = smb2_util_unlink(tree2, fname2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
talloc_free(fname2);
}
/* receive the 3rd notify */
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "test0.txt");
@@ -432,7 +458,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
sleep(3);
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, count-1);
for (i=0;i<notify.smb2.out.num_changes;i++) {
CHECK_VAL(notify.smb2.out.changes[i].action,
@@ -441,7 +468,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
notify.smb2.in.file.handle = h2;
req = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, count-1);
for (i=0;i<notify.smb2.out.num_changes;i++) {
CHECK_VAL(notify.smb2.out.changes[i].action,
@@ -458,10 +486,13 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
cl.smb2.level = RAW_CLOSE_SMB2;
cl.smb2.in.file.handle = h1;
status = smb2_close(tree1, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 9);
done:
@@ -480,7 +511,8 @@ static struct smb2_handle custom_smb2_create(struct smb2_tree *tree,
NTSTATUS status;
smb2_deltree(tree, smb2->in.fname);
status = smb2_create(tree, torture, smb2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = smb2->out.file.handle;
done:
if (!ret) {
@@ -530,7 +562,8 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify, on file or directory name
@@ -547,13 +580,15 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
req1 = smb2_notify_send(tree1, &(notify.smb2));
smb2_cancel(req1);
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = false;
req2 = smb2_notify_send(tree1, &(notify.smb2));
smb2_cancel(req2);
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io1.smb2);
io1.generic.level = RAW_OPEN_SMB2;
@@ -572,12 +607,14 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
io1.smb2.in.security_flags = 0;
io1.smb2.in.fname = BASEDIR "\\subdir-name";
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree2, io1.smb2.out.file.handle);
io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname1";
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sinfo);
sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
@@ -586,12 +623,14 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\subdir-name\\subname1-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sinfo);
sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
@@ -599,12 +638,14 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io1.smb2.in.fname = BASEDIR "\\subname2-r";
io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(sinfo);
sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
@@ -612,7 +653,8 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
sinfo.rename_information.in.root_fid = 0;
sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
notify.smb2.in.completion_filter = 0;
notify.smb2.in.recursive = true;
@@ -620,17 +662,21 @@ static bool torture_smb2_notify_recursive(struct torture_context *torture,
req1 = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = false;
req2 = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 9);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
@@ -696,7 +742,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify, on file or directory name
@@ -712,7 +759,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
smb2_cancel(req1);
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = false;
@@ -720,7 +768,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
smb2_cancel(req2);
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = true;
req1 = smb2_notify_send(tree1, &(notify.smb2));
@@ -746,11 +795,13 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
custom_smb2_create(tree1, torture, &(io1.smb2)));
status = smb2_util_setatr(tree1, BASEDIR "\\tname1",
FILE_ATTRIBUTE_HIDDEN);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_unlink(tree1, BASEDIR "\\tname1");
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
@@ -773,7 +824,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io1.smb2.in.fname = BASEDIR "\\subdir-name";
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree2, io1.smb2.out.file.handle);
ZERO_STRUCT(sinfo);
@@ -781,7 +833,8 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
io1.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sinfo.rename_information.level = RAW_SFILEINFO_RENAME_INFORMATION;
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
sinfo.rename_information.in.overwrite = true;
@@ -789,45 +842,55 @@ static bool torture_smb2_notify_mask_change(struct torture_context *torture,
sinfo.rename_information.in.new_name =
BASEDIR "\\subdir-name\\subname1-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io1.smb2.in.fname = BASEDIR "\\subdir-name\\subname2";
io1.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
io1.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
sinfo.rename_information.in.new_name = BASEDIR "\\subname2-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree2, io1.smb2.out.file.handle);
io1.smb2.in.fname = BASEDIR "\\subname2-r";
io1.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree2, torture, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sinfo.rename_information.in.file.handle = io1.smb2.out.file.handle;
sinfo.rename_information.in.new_name = BASEDIR "\\subname3-r";
status = smb2_setinfo_file(tree2, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree2, io1.smb2.out.file.handle);
status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name\\subname1-r");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_rmdir(tree2, BASEDIR "\\subdir-name");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_unlink(tree2, BASEDIR "\\subname3-r");
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subname2-r");
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
@@ -894,7 +957,9 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
do { for (mask=i=0;i<32;i++) { \
struct smb2_request *req; \
status = smb2_create(tree1, torture, &(io.smb2)); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal_goto(torture, status, \
+ NT_STATUS_OK, ret, done, \
+ "Status is wrong"); \
h1 = io.smb2.out.file.handle; \
setup \
notify.smb2.in.file.handle = h1; \
@@ -903,7 +968,10 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
req = smb2_notify_send(tree1, &(notify.smb2)); \
smb2_cancel(req); \
status = smb2_notify_recv(req, torture, &(notify.smb2)); \
- CHECK_STATUS(status, NT_STATUS_CANCELLED); \
+ torture_assert_ntstatus_equal_goto(torture, status, \
+ NT_STATUS_CANCELLED, \
+ ret,done, \
+ "Status is wrong"); \
/* send the change notify request */ \
req = smb2_notify_send(tree1, &(notify.smb2)); \
op \
@@ -912,7 +980,9 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
cleanup \
smb2_util_close(tree1, h1); \
if (NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED)) continue; \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal_goto(torture, status, \
+ NT_STATUS_OK, ret, done, \
+ "Status is wrong"); \
/* special case to cope with file rename behaviour */ \
if (nchanges == 2 && notify.smb2.out.num_changes == 1 && \
notify.smb2.out.changes[0].action == \
@@ -1134,7 +1204,8 @@ static bool torture_smb2_notify_file(struct torture_context *torture,
torture_comment(torture, "TESTING CHANGE NOTIFY ON FILES\n");
status = torture_smb2_testdir(tree, BASEDIR, &h1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io.smb2);
io.generic.level = RAW_OPEN_SMB2;
@@ -1150,7 +1221,8 @@ static bool torture_smb2_notify_file(struct torture_context *torture,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = fname;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1167,16 +1239,20 @@ static bool torture_smb2_notify_file(struct torture_context *torture,
req = smb2_notify_send(tree, &(notify.smb2));
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
ZERO_STRUCT(cl.smb2);
cl.close.level = RAW_CLOSE_SMB2;
cl.close.in.file.handle = h1;
status = smb2_close(tree, &(cl.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
smb2_deltree(tree, BASEDIR);
@@ -1221,7 +1297,8 @@ static bool torture_smb2_notify_tree_disconnect(
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1238,12 +1315,14 @@ static bool torture_smb2_notify_tree_disconnect(
status = smb2_notify_recv(req, torture, &(notify.smb2));
status = smb2_tdis(tree);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
req = smb2_notify_send(tree, &(notify.smb2));
smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -1290,7 +1369,8 @@ static bool torture_smb2_notify_tree_disconnect_1(
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1306,10 +1386,13 @@ static bool torture_smb2_notify_tree_disconnect_1(
WAIT_FOR_ASYNC_RESPONSE(req);
status = smb2_tdis(tree);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -1354,11 +1437,13 @@ static bool torture_smb2_notify_close(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1375,10 +1460,13 @@ static bool torture_smb2_notify_close(struct torture_context *torture,
WAIT_FOR_ASYNC_RESPONSE(req);
status = smb2_util_close(tree1, h1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -1423,11 +1511,13 @@ static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1444,10 +1534,13 @@ static bool torture_smb2_notify_ulogoff(struct torture_context *torture,
WAIT_FOR_ASYNC_RESPONSE(req);
status = smb2_logoff(tree1->session);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -1494,11 +1587,13 @@ static bool torture_smb2_notify_session_reconnect(struct torture_context *tortur
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1522,14 +1617,19 @@ static bool torture_smb2_notify_session_reconnect(struct torture_context *tortur
"session setup with previous_session_id failed");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
status = smb2_logoff(tree1->session);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
status = smb2_logoff(session2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
smb2_deltree(tree1, BASEDIR);
return ret;
@@ -1574,11 +1674,13 @@ static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1605,10 +1707,14 @@ static bool torture_smb2_notify_invalid_reauth(struct torture_context *torture,
status = smb2_session_setup_spnego(tree1->session,
invalid_creds,
0 /* previous_session_id */);
- CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_LOGON_FAILURE,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_CLEANUP);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_CLEANUP,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -1664,7 +1770,8 @@ static bool torture_smb2_notify_tcp_disconnect(
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1679,7 +1786,8 @@ static bool torture_smb2_notify_tcp_disconnect(
req = smb2_notify_send(tree, &(notify.smb2));
smb2_cancel(req);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = true;
req = smb2_notify_send(tree, &(notify.smb2));
@@ -1687,7 +1795,9 @@ static bool torture_smb2_notify_tcp_disconnect(
tcp_dis_handler, 250, tree);
tree = NULL;
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_LOCAL_DISCONNECT);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_LOCAL_DISCONNECT,
+ ret, done, "Status is wrong");
done:
return ret;
@@ -1734,7 +1844,8 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -1749,26 +1860,30 @@ static bool torture_smb2_notify_double(struct torture_context *torture,
req1 = smb2_notify_send(tree1, &(notify.smb2));
smb2_cancel(req1);
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
req2 = smb2_notify_send(tree1, &(notify.smb2));
smb2_cancel(req2);
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
smb2_util_mkdir(tree2, BASEDIR "\\subdir-name");
req1 = smb2_notify_send(tree1, &(notify.smb2));
req2 = smb2_notify_send(tree1, &(notify.smb2));
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
smb2_util_mkdir(tree2, BASEDIR "\\subdir-name2");
status = smb2_notify_recv(req2, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name2");
@@ -1842,7 +1957,8 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
io.smb2.in.security_flags = 0;
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(notify.smb2);
notify.smb2.level = RAW_NOTIFY_SMB2;
@@ -1854,7 +1970,10 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
for (i=0;i<ARRAY_SIZE(dirs);i++) {
io.smb2.in.fname = dirs[i].path;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
dirs[i].h1 = io.smb2.out.file.handle;
notify.smb2.in.completion_filter = dirs[i].filter;
@@ -1863,7 +1982,9 @@ static bool torture_smb2_notify_tree(struct torture_context *torture,
req = smb2_notify_send(tree, &(notify.smb2));
smb2_cancel(req);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_CANCELLED, ret,
+ done, "Status is wrong");
}
/* trigger 2 events in each dir */
@@ -1964,7 +2085,8 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify, on name changes. */
@@ -1980,7 +2102,8 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
/* cancel initial requests so the buffer is setup */
smb2_cancel(req1);
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
/* open a lot of files, filling up the server side notify buffer */
torture_comment(torture,
@@ -2012,7 +2135,9 @@ static bool torture_smb2_notify_overflow(struct torture_context *torture,
req1 = smb2_notify_send(tree, &(notify.smb2));
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ STATUS_NOTIFY_ENUM_DIR,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 0);
done:
@@ -2057,14 +2182,16 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* create a test file that will also be modified */
io.smb2.in.fname = BASEDIR "\\tname1";
io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
status = smb2_create(tree2, torture, &(io.smb2));
- CHECK_STATUS(status,NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree2, io.smb2.out.file.handle);
/* ask for a change notify, on attribute changes. */
@@ -2086,7 +2213,8 @@ static bool torture_smb2_notify_basedir(struct torture_context *torture,
/* check how many responses were given, expect only 1 for the file */
status = smb2_notify_recv(req1, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "tname1");
@@ -2136,7 +2264,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.smb2.out.file.handle;
/* ask for a change notify,
@@ -2152,15 +2281,18 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
req = smb2_notify_send(tree, &(notify.smb2));
smb2_cancel(req);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
notify.smb2.in.recursive = true;
req = smb2_notify_send(tree, &(notify.smb2));
status = smb2_util_mkdir(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
@@ -2169,10 +2301,12 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
torture_comment(torture, "Testing notify rmdir\n");
req = smb2_notify_send(tree, &(notify.smb2));
status = smb2_util_rmdir(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
@@ -2195,7 +2329,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
smb2_util_mkdir(tree1, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
@@ -2206,7 +2341,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
smb2_util_rmdir(tree, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
@@ -2215,7 +2351,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
torture_comment(torture, "Disconnecting secondary tree\n");
status = smb2_tdis(tree1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
talloc_free(tree1);
torture_comment(torture, "Testing notify mkdir\n");
@@ -2223,7 +2360,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
smb2_util_mkdir(tree, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_ADDED);
@@ -2234,7 +2372,8 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
smb2_util_rmdir(tree, fname);
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "subdir-name");
@@ -2282,7 +2421,8 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
io.smb2.in.fname = BASEDIR;
status = smb2_create(tree1, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.smb2.out.file.handle;
ZERO_STRUCT(notify.smb2);
@@ -2298,22 +2438,33 @@ static bool torture_smb2_notify_rmdir(struct torture_context *torture,
if (initial_delete_on_close) {
status = smb2_util_rmdir(tree2, BASEDIR);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
} else {
status = smb2_create(tree2, torture, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
sfinfo.generic.in.file.handle = io.smb2.out.file.handle;
sfinfo.disposition_info.in.delete_on_close = 1;
status = smb2_setinfo_file(tree2, &sfinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
smb2_util_close(tree2, io.smb2.out.file.handle);
}
status = smb2_notify_recv(req, torture, &(notify.smb2));
- CHECK_STATUS(status, NT_STATUS_DELETE_PENDING);
+ torture_assert_ntstatus_equal_goto(torture, status,
+ NT_STATUS_DELETE_PENDING,
+ ret, done, "Status is wrong");
done:
--
1.9.1
>From b0870dabaee9ac4a49d6fb6f89064bddce1c172a Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:57:06 +1200
Subject: [PATCH 09/14] Replace CHECK_STATUS macro in lease.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/lease.c | 517 +++++++++++++++++++++++++++++--------------
1 file changed, 348 insertions(+), 169 deletions(-)
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 4b435a1..aa7dfc1 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -37,14 +37,6 @@
ret = false; \
}} while (0)
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
- nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_CREATED(__io, __created, __attribute) \
do { \
CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
@@ -143,7 +135,8 @@ static bool test_lease_request(struct torture_context *tctx,
/* Win7 is happy to grant RHW leases on files. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE1, 0);
@@ -152,7 +145,9 @@ static bool test_lease_request(struct torture_context *tctx,
if (!(caps & SMB2_CAP_DIRECTORY_LEASING)) {
smb2_lease_create(&io, &ls, true, dname, LEASE2, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_DIRECTORY);
CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
smb2_util_close(tree, io.out.file.handle);
@@ -161,13 +156,16 @@ static bool test_lease_request(struct torture_context *tctx,
/* Also rejects multiple files leased under the same key. */
smb2_lease_create(&io, &ls, true, fname2, LEASE1, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
/* And grants leases on streams (with separate leasekey). */
smb2_lease_create(&io, &ls, false, sname, LEASE2, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
h2 = io.out.file.handle;
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE2, 0);
smb2_util_close(tree, h2);
@@ -184,7 +182,9 @@ static bool test_lease_request(struct torture_context *tctx,
smb2_util_lease_state(request_results[i][0]));
status = smb2_create(tree, mem_ctx, &io);
h2 = io.out.file.handle;
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, request_results[i][1], true, LEASE1, 0);
smb2_util_close(tree, io.out.file.handle);
@@ -225,7 +225,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
/* Grab a RH lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE1, 0);
h = io.out.file.handle;
@@ -233,7 +234,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
/* Upgrades (sidegrades?) to RW leave us with an RH. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE1, 0);
hnew = io.out.file.handle;
@@ -243,7 +245,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
/* Upgrade to RHW lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE1, 0);
hnew = io.out.file.handle;
@@ -254,7 +257,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
/* Attempt to downgrade - original lease state is maintained. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE1, 0);
hnew = io.out.file.handle;
@@ -353,7 +357,9 @@ static bool test_lease_upgrade2(struct torture_context *tctx,
/* Grab a lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(t.initial));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, t.initial, true, LEASE1, 0);
h = io.out.file.handle;
@@ -361,7 +367,9 @@ static bool test_lease_upgrade2(struct torture_context *tctx,
/* Upgrade. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(t.upgrade_to));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, t.expected, true, LEASE1, 0);
hnew = io.out.file.handle;
@@ -610,7 +618,9 @@ static bool test_lease_upgrade3(struct torture_context *tctx,
/* grab first lease */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(t.held1));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, t.held1, true, LEASE1, 0);
h = io.out.file.handle;
@@ -618,7 +628,9 @@ static bool test_lease_upgrade3(struct torture_context *tctx,
/* grab second lease */
smb2_lease_create(&io, &ls, false, fname, LEASE2, smb2_util_lease_state(t.held2));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, t.held2, true, LEASE2, 0);
h2 = io.out.file.handle;
@@ -630,7 +642,9 @@ static bool test_lease_upgrade3(struct torture_context *tctx,
/* try to upgrade lease1 */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(t.upgrade_to));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, t.upgraded_to, true, LEASE1, 0);
hnew = io.out.file.handle;
@@ -781,7 +795,9 @@ static bool test_lease_break(struct torture_context *tctx,
/* Grab lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(held));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, held, true, LEASE1, 0);
@@ -789,7 +805,9 @@ static bool test_lease_break(struct torture_context *tctx,
/* Possibly contend lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE2, smb2_util_lease_state(contend));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, granted, true, LEASE2, 0);
@@ -808,7 +826,9 @@ static bool test_lease_break(struct torture_context *tctx,
*/
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h3 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, brokento, true, LEASE1, 0);
@@ -820,7 +840,9 @@ static bool test_lease_break(struct torture_context *tctx,
smb2_util_close(tree, h3);
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
done:
@@ -859,7 +881,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE1,
smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "R", true, LEASE1, 0);
@@ -867,7 +890,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE2,
smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_LEASE(&io, "R", true, LEASE2, 0);
@@ -879,7 +903,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
/* Make sure we don't break ourselves on write */
status = smb2_util_write(tree, h1, &c, 0, 1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_BREAK_INFO("R", "", LEASE2);
/* Try the other way round. First, upgrade LEASE2 to R again */
@@ -887,7 +912,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE2,
smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io, "R", true, LEASE2, 0);
smb2_util_close(tree, io.out.file.handle);
@@ -895,14 +921,16 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
ZERO_STRUCT(break_info);
status = smb2_util_write(tree, h2, &c, 0, 1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_BREAK_INFO("R", "", LEASE1);
/* .. and break LEASE2 via h1 */
ZERO_STRUCT(break_info);
status = smb2_util_write(tree, h1, &c, 0, 1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_BREAK_INFO("R", "", LEASE2);
done:
@@ -937,7 +965,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
@@ -948,7 +977,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
smb2_util_lease_state("RWH"));
io.in.desired_access = FILE_READ_ATTRIBUTES;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
@@ -962,7 +992,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE1,
smb2_util_lease_state(""));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
@@ -974,7 +1005,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
smb2_lease_create(&io, &ls, false, fname, LEASE2,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE2, 0);
@@ -1106,7 +1138,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
/* Grab lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(held));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, held, true, LEASE1, 0);
@@ -1114,7 +1148,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
/* Does an oplock contend the lease? */
smb2_oplock_create(&io, fname, smb2_util_oplock_level(contend));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level(granted));
@@ -1130,7 +1166,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
smb2_util_close(tree, h2);
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
for (i = 0; i < NOPLOCK_RESULTS; i++) {
@@ -1148,7 +1186,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
/* Grab an oplock. */
smb2_oplock_create(&io, fname, smb2_util_oplock_level(held));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level(held));
@@ -1157,7 +1197,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
/* Grab lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state(contend));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, granted, true, LEASE1, 0);
@@ -1172,7 +1214,9 @@ static bool test_lease_oplock(struct torture_context *tctx,
smb2_util_close(tree, h2);
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
}
done:
@@ -1216,14 +1260,16 @@ static bool test_lease_multibreak(struct torture_context *tctx,
/* Grab lease, upgrade to RHW .. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE1, 0);
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE1, 0);
@@ -1231,7 +1277,8 @@ static bool test_lease_multibreak(struct torture_context *tctx,
/* Contend with LEASE2. */
smb2_lease_create(&io, &ls, false, fname, LEASE2, smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE2, 0);
@@ -1241,18 +1288,22 @@ static bool test_lease_multibreak(struct torture_context *tctx,
/* Drop LEASE1 / LEASE2 */
status = smb2_util_close(tree, h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_close(tree, h2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_close(tree, h3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(break_info);
/* Grab an R lease. */
smb2_lease_create(&io, &ls, false, fname, LEASE1, smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "R", true, LEASE1, 0);
@@ -1260,7 +1311,8 @@ static bool test_lease_multibreak(struct torture_context *tctx,
/* Grab a level-II oplock. */
smb2_oplock_create(&io, fname, smb2_util_oplock_level("s"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("s"));
@@ -1273,7 +1325,8 @@ static bool test_lease_multibreak(struct torture_context *tctx,
smb2_generic_create(&io, NULL, false, fname,
NTCREATEX_DISP_OVERWRITE_IF, smb2_util_oplock_level(""), 0, 0);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io.out.file.handle;
CHECK_CREATED(&io, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level(""));
@@ -1287,7 +1340,8 @@ static bool test_lease_multibreak(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Verify one oplock break, one lease break. */
CHECK_OPLOCK_BREAK("");
@@ -1344,7 +1398,8 @@ static bool test_lease_v2_request_parent(struct torture_context *tctx,
0x11);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1,
@@ -1395,7 +1450,8 @@ static bool test_lease_break_twice(struct torture_context *tctx,
LEASE1, NULL, smb2_util_lease_state("RWH"), 0x11);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls1.lease_epoch + 1);
@@ -1410,7 +1466,9 @@ static bool test_lease_break_twice(struct torture_context *tctx,
LEASE2, NULL, smb2_util_lease_state("RWH"), 0x22);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_SHARING_VIOLATION,
+ ret, done, "Status is wrong");
CHECK_BREAK_INFO_V2(tree->session->transport,
"RWH", "RW", LEASE1, ls1.lease_epoch + 2);
@@ -1421,7 +1479,8 @@ static bool test_lease_break_twice(struct torture_context *tctx,
ZERO_STRUCT(break_info);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_V2(&io, "RH", true, LEASE2, 0, 0, ls2.lease_epoch + 1);
CHECK_BREAK_INFO_V2(tree->session->transport,
"RW", "R", LEASE1, ls1.lease_epoch + 3);
@@ -1481,7 +1540,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
0x11);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls1.lease_epoch + 1);
@@ -1493,7 +1553,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x22);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_DIRECTORY);
CHECK_LEASE_V2(&io, "RH", true, LEASE2, 0, 0, ls2.lease_epoch + 1);
@@ -1505,7 +1566,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x33);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE3,
@@ -1521,7 +1583,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x44);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h4 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE4, 0, 0, ls4.lease_epoch + 1);
@@ -1539,7 +1602,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
0x222);
io.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h5 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_DIRECTORY);
CHECK_LEASE_V2(&io, "RH", true, LEASE2, 0, 0, ls2.lease_epoch+3);
@@ -1551,7 +1615,8 @@ static bool test_lease_v2_request(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* Wait 4 seconds in order to check if the write time
@@ -1623,7 +1688,8 @@ static bool test_lease_v2_epoch1(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x4711);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls.lease_epoch + 1);
@@ -1637,7 +1703,8 @@ static bool test_lease_v2_epoch1(struct torture_context *tctx,
0x11);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RWH", true, LEASE1, 0, 0, ls.lease_epoch + 1);
@@ -1688,7 +1755,8 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
smb2_util_lease_state("R"),
0x4711);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv2 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "R", true, LEASE1, 0, 0, ls1v2.lease_epoch + 1);
@@ -1699,7 +1767,8 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RH", true, LEASE1, 0, 0, ls1v2.lease_epoch + 2);
@@ -1713,7 +1782,8 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x11);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls1v2.lease_epoch + 3);
@@ -1722,7 +1792,8 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
smb2_oplock_create(&io, fname, SMB2_OPLOCK_LEVEL_NONE);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -1739,7 +1810,8 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RHW"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RHW", true, LEASE1, 0);
@@ -1792,7 +1864,8 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "R", true, LEASE1, 0);
@@ -1804,7 +1877,8 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
smb2_util_lease_state("RW"),
0x4711);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RW", true, LEASE1, 0);
@@ -1817,7 +1891,8 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
@@ -1826,7 +1901,8 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
smb2_oplock_create(&io, fname, SMB2_OPLOCK_LEVEL_NONE);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -1843,7 +1919,8 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
smb2_util_lease_state("RWH"),
0x4711);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
hv2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls1v2.lease_epoch + 1);
@@ -1897,7 +1974,8 @@ static bool test_lease_breaking1(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1a = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, 0);
@@ -1928,7 +2006,8 @@ static bool test_lease_breaking1(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -1942,14 +2021,16 @@ static bool test_lease_breaking1(struct torture_context *tctx,
* We ack the lease break.
*/
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "RH", LEASE1);
torture_assert(tctx, req2->cancel.can_cancel,
"req2 can_cancel");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2004,7 +2085,8 @@ static bool test_lease_breaking2(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1a = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, 0);
@@ -2034,7 +2116,8 @@ static bool test_lease_breaking2(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2050,49 +2133,66 @@ static bool test_lease_breaking2(struct torture_context *tctx,
ack.in.lease.lease_state =
SMB2_LEASE_READ | SMB2_LEASE_WRITE | SMB2_LEASE_HANDLE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state =
SMB2_LEASE_READ | SMB2_LEASE_WRITE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state =
SMB2_LEASE_WRITE | SMB2_LEASE_HANDLE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state =
SMB2_LEASE_READ | SMB2_LEASE_HANDLE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state = SMB2_LEASE_WRITE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state = SMB2_LEASE_HANDLE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
ack.in.lease.lease_state = SMB2_LEASE_READ;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_REQUEST_NOT_ACCEPTED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_REQUEST_NOT_ACCEPTED,
+ ret, done, "Status is wrong");
/* Try again with the correct state this time. */
ack.in.lease.lease_state = SMB2_LEASE_NONE;;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "", LEASE1);
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_UNSUCCESSFUL,
+ ret, done, "Status is wrong");
torture_assert(tctx, req2->cancel.can_cancel,
"req2 can_cancel");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2102,7 +2202,8 @@ static bool test_lease_breaking2(struct torture_context *tctx,
/* Get state of the original handle. */
smb2_lease_create(&io1, &ls1, false, fname, LEASE1, smb2_util_lease_state(""));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io1, "", true, LEASE1, 0);
smb2_util_close(tree, io1.out.file.handle);
@@ -2159,7 +2260,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1a = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, 0);
@@ -2184,7 +2286,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2216,7 +2319,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2229,7 +2333,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
*/
break_info.lease_skip_ack = true;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "RH", LEASE1);
/*
@@ -2249,7 +2354,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2264,7 +2370,8 @@ static bool test_lease_breaking3(struct torture_context *tctx,
* We ack the downgrade to "R" and get an immediate break to none
*/
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "R", LEASE1);
/*
@@ -2280,13 +2387,15 @@ static bool test_lease_breaking3(struct torture_context *tctx,
ZERO_STRUCT(break_info);
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
status = smb2_create_recv(req3, tctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io3.out.file.handle;
CHECK_CREATED(&io3, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io3.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2354,7 +2463,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x11);
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1a = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
/* Epoch increases on open. */
@@ -2385,7 +2495,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io1, "RHW", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS, 0, ls1.lease_epoch);
@@ -2417,7 +2528,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io1, "RHW", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS, 0, ls1.lease_epoch);
@@ -2430,7 +2542,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
*/
break_info.lease_skip_ack = true;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "RH", LEASE1);
/*
@@ -2453,7 +2566,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io1, "RH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS, 0, ls1.lease_epoch);
@@ -2468,7 +2582,8 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
* We ack the downgrade to "R" and get an immediate break to none
*/
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "R", LEASE1);
/*
@@ -2485,13 +2600,15 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
ZERO_STRUCT(break_info);
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
status = smb2_create_recv(req3, tctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io3.out.file.handle;
CHECK_CREATED(&io3, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io3.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2552,7 +2669,8 @@ static bool test_lease_breaking4(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RH"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RH", true, LEASE1, 0);
@@ -2581,7 +2699,8 @@ static bool test_lease_breaking4(struct torture_context *tctx,
torture_assert(tctx, req2->state == SMB2_REQUEST_DONE, "req2 done");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2603,7 +2722,8 @@ static bool test_lease_breaking4(struct torture_context *tctx,
torture_assert(tctx, req2->state == SMB2_REQUEST_DONE, "req2 done");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2621,7 +2741,8 @@ static bool test_lease_breaking4(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state(""));
status = smb2_create(tree, mem_ctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io3.out.file.handle;
CHECK_CREATED(&io3, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io3, "RH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2639,7 +2760,8 @@ static bool test_lease_breaking4(struct torture_context *tctx,
break_info.lease_skip_ack = true;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "", LEASE1);
CHECK_NO_BREAK(tctx);
@@ -2697,7 +2819,8 @@ static bool test_lease_breaking5(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "R", true, LEASE1, 0);
@@ -2726,7 +2849,8 @@ static bool test_lease_breaking5(struct torture_context *tctx,
torture_assert(tctx, req2->state == SMB2_REQUEST_DONE, "req2 done");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, TRUNCATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2743,7 +2867,8 @@ static bool test_lease_breaking5(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state(""));
status = smb2_create(tree, mem_ctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io3.out.file.handle;
CHECK_CREATED(&io3, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io3, "", true, LEASE1, 0);
@@ -2759,7 +2884,8 @@ static bool test_lease_breaking5(struct torture_context *tctx,
break_info.lease_break.new_lease_state;
ZERO_STRUCT(break_info);
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_UNSUCCESSFUL,
+ ret, done, "Status is wrong");
CHECK_NO_BREAK(tctx);
@@ -2813,7 +2939,8 @@ static bool test_lease_breaking6(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1a = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, 0);
@@ -2842,7 +2969,8 @@ static bool test_lease_breaking6(struct torture_context *tctx,
* but reports SMB2_LEASE_FLAG_BREAK_IN_PROGRESS
*/
status = smb2_create(tree, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1b = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, SMB2_LEASE_FLAG_BREAK_IN_PROGRESS);
@@ -2858,14 +2986,16 @@ static bool test_lease_breaking6(struct torture_context *tctx,
*/
ack.in.lease.lease_state = SMB2_LEASE_NONE;
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "", LEASE1);
torture_assert(tctx, req2->cancel.can_cancel,
"req2 can_cancel");
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_NONE);
@@ -2944,7 +3074,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
LEASE1,
smb2_util_lease_state("RWH"));
status = smb2_create(tree1a, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RWH", true, LEASE1, 0);
@@ -2955,7 +3086,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
LEASE2,
smb2_util_lease_state("RWH"));
status = smb2_create(tree1b, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io2, "RH", true, LEASE2, 0);
@@ -2969,7 +3101,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
LEASE3,
smb2_util_lease_state("RWH"));
status = smb2_create(tree2, mem_ctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io3.out.file.handle;
CHECK_CREATED(&io3, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io3, "RH", true, LEASE3, 0);
@@ -2990,7 +3123,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
el[0].reserved = 0;
el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE;
status = smb2_lock(tree1a, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* LEASE2 and LEASE3 should get broken to NONE. */
torture_wait_for_lease_break(tctx);
@@ -3004,7 +3138,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
/* Get state of the H1 (LEASE1) */
smb2_lease_create(&io1, &ls1, false, fname, LEASE1, smb2_util_lease_state(""));
status = smb2_create(tree1a, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Should still be RH. */
CHECK_LEASE(&io1, "RH", true, LEASE1, 0);
smb2_util_close(tree1a, io1.out.file.handle);
@@ -3012,14 +3147,16 @@ static bool test_lease_lock1(struct torture_context *tctx,
/* Get state of the H2 (LEASE2) */
smb2_lease_create(&io2, &ls2, false, fname, LEASE2, smb2_util_lease_state(""));
status = smb2_create(tree1b, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io2, "", true, LEASE2, 0);
smb2_util_close(tree1b, io2.out.file.handle);
/* Get state of the H3 (LEASE3) */
smb2_lease_create(&io3, &ls3, false, fname, LEASE3, smb2_util_lease_state(""));
status = smb2_create(tree2, mem_ctx, &io3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io3, "", true, LEASE3, 0);
smb2_util_close(tree2, io3.out.file.handle);
@@ -3037,7 +3174,8 @@ static bool test_lease_lock1(struct torture_context *tctx,
el[0].reserved = 0;
el[0].flags = SMB2_LOCK_FLAG_EXCLUSIVE;
status = smb2_lock(tree2, &lck);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* LEASE1 got broken to NONE. */
CHECK_BREAK_INFO("RH", "", LEASE1);
ZERO_STRUCT(break_info);
@@ -3100,7 +3238,8 @@ static bool test_lease_complex1(struct torture_context *tctx,
/* Grab R lease over connection 1a */
smb2_lease_create(&io1, &ls1, false, fname, LEASE1, smb2_util_lease_state("R"));
status = smb2_create(tree1a, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "R", true, LEASE1, 0);
@@ -3108,19 +3247,22 @@ static bool test_lease_complex1(struct torture_context *tctx,
/* Upgrade to RWH over connection 1b */
ls1.lease_state = smb2_util_lease_state("RWH");
status = smb2_create(tree1b, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RHW", true, LEASE1, 0);
/* close over connection 1b */
status = smb2_util_close(tree1b, h2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Contend with LEASE2. */
smb2_lease_create(&io2, &ls2, false, fname, LEASE2, smb2_util_lease_state("R"));
status = smb2_create(tree1b, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io2, "R", true, LEASE2, 0);
@@ -3131,14 +3273,16 @@ static bool test_lease_complex1(struct torture_context *tctx,
/* again RH over connection 1b doesn't change the epoch */
ls1.lease_state = smb2_util_lease_state("RH");
status = smb2_create(tree1b, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io1, "RH", true, LEASE1, 0);
/* close over connection 1b */
status = smb2_util_close(tree1b, h2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(break_info);
@@ -3148,7 +3292,8 @@ static bool test_lease_complex1(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree1a, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ls2.lease_epoch += 1;
CHECK_BREAK_INFO("R", "", LEASE2);
@@ -3161,7 +3306,8 @@ static bool test_lease_complex1(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree1b, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ls1.lease_epoch += 1;
CHECK_BREAK_INFO("RH", "", LEASE1);
@@ -3233,7 +3379,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
smb2_lease_v2_create(&io1, &ls1, false, fname, LEASE1, NULL,
smb2_util_lease_state("R"), 0x4711);
status = smb2_create(tree1a, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
ls1.lease_epoch += 1;
@@ -3243,7 +3390,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
/* Upgrade to RWH over connection 1b */
ls1.lease_state = smb2_util_lease_state("RWH");
status = smb2_create(tree1b, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
ls1.lease_epoch += 1;
@@ -3252,13 +3400,15 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
/* close over connection 1b */
status = smb2_util_close(tree1b, h2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Contend with LEASE2. */
smb2_lease_v2_create(&io2, &ls2, false, fname, LEASE2, NULL,
smb2_util_lease_state("R"), 0x11);
status = smb2_create(tree1b, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h3 = io2.out.file.handle;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
ls2.lease_epoch += 1;
@@ -3273,7 +3423,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
/* again RH over connection 1b doesn't change the epoch */
ls1.lease_state = smb2_util_lease_state("RH");
status = smb2_create(tree1b, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io1.out.file.handle;
CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io1, "RH", true, LEASE1,
@@ -3281,7 +3432,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
/* close over connection 1b */
status = smb2_util_close(tree1b, h2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ZERO_STRUCT(break_info);
@@ -3291,7 +3443,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree1a, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ls2.lease_epoch += 1;
CHECK_BREAK_INFO_V2(tree1a->session->transport,
@@ -3305,7 +3458,8 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, 'o', w.in.data.length);
status = smb2_write(tree1b, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ls1.lease_epoch += 1;
CHECK_BREAK_INFO_V2(tree1a->session->transport,
@@ -3379,7 +3533,8 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
smb2_lease_v2_create(&io1, &ls1, false, fname, LEASE1, NULL,
smb2_util_lease_state("RWH"), 0x4711);
status = smb2_create(tree1a, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io1.out.file.handle;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
ls1.lease_epoch += 1;
@@ -3409,13 +3564,15 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
ack.in.lease.lease_state = SMB2_LEASE_HANDLE|SMB2_LEASE_READ;
status = smb2_lease_break_ack(tree1b, &ack);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE_BREAK_ACK(&ack, "RH", LEASE1);
ZERO_STRUCT(break_info);
status = smb2_create_recv(req2, tctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io2, "RH", true, LEASE2,
0, 0, ls2.lease_epoch+1);
@@ -3459,7 +3616,8 @@ static bool test_lease_timeout(struct torture_context *tctx,
/* Grab a RWH lease. */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
h = io.out.file.handle;
@@ -3491,19 +3649,22 @@ static bool test_lease_timeout(struct torture_context *tctx,
/* Now wait for the timeout and get the reply. */
status = smb2_create_recv(req2, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RH", true, LEASE2, 0);
hnew = io.out.file.handle;
/* Ack the break after the timeout... */
status = smb2_lease_break_ack(tree, &ack);
- CHECK_STATUS(status, NT_STATUS_UNSUCCESSFUL);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_UNSUCCESSFUL,
+ ret, done, "Status is wrong");
/* Get state of the original handle. */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state(""));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io, "", true, LEASE1, 0);
smb2_util_close(tree, io.out.file.handle);
@@ -3515,7 +3676,8 @@ static bool test_lease_timeout(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, '1', w.in.data.length);
status = smb2_write(tree, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Causes new handle to break to NONE. */
CHECK_BREAK_INFO("RH", "", LEASE2);
@@ -3528,7 +3690,8 @@ static bool test_lease_timeout(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 1024);
memset(w.in.data.data, '2', w.in.data.length);
status = smb2_write(tree, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* No break - original handle was already NONE. */
CHECK_NO_BREAK(tctx);
smb2_util_close(tree, hnew);
@@ -3536,7 +3699,8 @@ static bool test_lease_timeout(struct torture_context *tctx,
/* Upgrade to R on LEASE1. */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("R"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io, "R", true, LEASE1, 0);
h1b = io.out.file.handle;
smb2_util_close(tree, h1b);
@@ -3544,7 +3708,8 @@ static bool test_lease_timeout(struct torture_context *tctx,
/* Upgrade to RWH on LEASE1. */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
h1b = io.out.file.handle;
smb2_util_close(tree, h1b);
@@ -3604,7 +3769,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
smb2_util_lease_state("RHW"),
0x4711);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
ls1.lease_epoch += 1;
@@ -3617,7 +3783,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.new_name = fname_dst;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* No lease break. */
CHECK_NO_BREAK(tctx);
@@ -3629,7 +3796,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
smb2_util_lease_state(""),
ls1.lease_epoch);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RHW", true, LEASE1, 0, 0, ls1.lease_epoch);
@@ -3642,7 +3810,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
smb2_util_lease_state("RWH"),
0x44);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
ls2.lease_epoch += 1;
@@ -3659,7 +3828,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
sinfo.rename_information.in.overwrite = true;
sinfo.rename_information.in.new_name = fname;
status = smb2_setinfo_file(tree, &sinfo);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Breaks to R on LEASE2. */
CHECK_BREAK_INFO_V2(tree->session->transport,
@@ -3673,7 +3843,8 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
smb2_util_lease_state(""),
ls1.lease_epoch);
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE_V2(&io, "RH", true, LEASE1, 0, 0, ls1.lease_epoch);
@@ -3777,7 +3948,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
/* Get RWH lease over connection 2_1 */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_2_1, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
h = io.out.file.handle;
@@ -3788,12 +3960,14 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 4096);
memset(w.in.data.data, '1', w.in.data.length);
status = smb2_write(tree_2_1, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Open the same name over connection 3_0. */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_3_0, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h1 = io.out.file.handle;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -3806,7 +3980,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
/* Try to upgrade to RWH over connection 2_1 */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_2_1, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
CHECK_VAL(io.out.size, 4096);
@@ -3818,7 +3993,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
/* Try to upgrade to RWH over connection 3_0 */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_3_0, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h2 = io.out.file.handle;
CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
CHECK_VAL(io.out.size, 0);
@@ -3833,7 +4009,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
w.in.data = data_blob_talloc(mem_ctx, NULL, 1024);
memset(w.in.data.data, '2', w.in.data.length);
status = smb2_write(tree_3_0, &w);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Close everything.. */
smb2_util_close(tree_2_1, h);
@@ -3842,7 +4019,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
/* And ensure we can get a lease ! */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_2_1, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
@@ -3855,7 +4033,8 @@ static bool test_lease_dynamic_share(struct torture_context *tctx,
/* And ensure we can get a lease ! */
smb2_lease_create(&io, &ls1, false, fname, LEASE1, smb2_util_lease_state("RWH"));
status = smb2_create(tree_3_0, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
CHECK_LEASE(&io, "RWH", true, LEASE1, 0);
--
1.9.1
>From 7dba9a22cf718145d80bf930a613ae3d117fa593 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 12:59:28 +1200
Subject: [PATCH 10/14] Replace CHECK_STATUS macro in durable_v2_open.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/durable_v2_open.c | 159 ++++++++++++++++++++++-----------
1 file changed, 108 insertions(+), 51 deletions(-)
diff --git a/source4/torture/smb2/durable_v2_open.c b/source4/torture/smb2/durable_v2_open.c
index f3ec344..a43f075 100644
--- a/source4/torture/smb2/durable_v2_open.c
+++ b/source4/torture/smb2/durable_v2_open.c
@@ -34,14 +34,6 @@
ret = false; \
}} while (0)
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
- nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_CREATED(__io, __created, __attribute) \
do { \
CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
@@ -116,7 +108,8 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -148,7 +141,9 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
io.in.durable_open = true; /* durable v1 handle request */
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
@@ -156,7 +151,9 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
io.in.durable_open_v2 = true; /* durable v2 handle request */
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
@@ -164,7 +161,9 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
io.in.durable_handle_v2 = h; /* durable v2 reconnect request */
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
@@ -172,7 +171,9 @@ bool test_durable_v2_open_create_blob(struct torture_context *tctx,
io.in.durable_open_v2 = true; /* durable v2 handle request */
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
done:
if (h != NULL) {
@@ -270,7 +271,8 @@ static bool test_one_durable_v2_open_oplock(struct torture_context *tctx,
io.in.create_guid = GUID_random();
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -432,7 +434,8 @@ static bool test_one_durable_v2_open_lease(struct torture_context *tctx,
io.in.create_guid = GUID_random();
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -540,7 +543,8 @@ bool test_durable_v2_open_reopen1(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -556,7 +560,9 @@ bool test_durable_v2_open_reopen1(struct torture_context *tctx,
io.in.durable_handle_v2 = h;
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
done:
if (h != NULL) {
@@ -613,7 +619,8 @@ bool test_durable_v2_open_reopen1a(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -646,7 +653,9 @@ bool test_durable_v2_open_reopen1a(struct torture_context *tctx,
io.in.durable_handle_v2 = h;
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
/*
* but a durable reconnect on the new session succeeds:
@@ -657,7 +666,8 @@ bool test_durable_v2_open_reopen1a(struct torture_context *tctx,
io2.in.durable_handle_v2 = h;
io2.in.create_guid = create_guid;
status = smb2_create(tree2, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
CHECK_VAL(io2.out.durable_open, false);
@@ -714,7 +724,8 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -741,19 +752,25 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
io.in.fname = "";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = "__non_existing_fname__";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/* a non-zero but non-matching create_guid does not change it: */
ZERO_STRUCT(io);
@@ -761,7 +778,9 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
io.in.durable_handle_v2 = h;
io.in.create_guid = create_guid_invalid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/*
* now success:
@@ -775,7 +794,8 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
CHECK_VAL(io.out.durable_open_v2, false); /* no dh2q response blob */
@@ -817,7 +837,8 @@ bool test_durable_v2_open_reopen2(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
CHECK_VAL(io.out.durable_open_v2, false); /* no dh2q response blob */
@@ -875,7 +896,8 @@ bool test_durable_v2_open_reopen2b(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -899,7 +921,9 @@ bool test_durable_v2_open_reopen2b(struct torture_context *tctx,
io.in.durable_handle_v2 = h; /* durable v2 reconnect */
io.in.create_guid = GUID_zero(); /* but zero create GUID */
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
@@ -907,7 +931,8 @@ bool test_durable_v2_open_reopen2b(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
CHECK_VAL(io.out.durable_open_v2, false); /* no dh2q response blob */
@@ -964,7 +989,8 @@ bool test_durable_v2_open_reopen2c(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -988,7 +1014,9 @@ bool test_durable_v2_open_reopen2c(struct torture_context *tctx,
io.in.durable_handle_v2 = h; /* durable v2 reconnect */
io.in.create_guid = create_guid;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
done:
if (h != NULL) {
@@ -1048,7 +1076,8 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1085,19 +1114,25 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
io.in.fname = "";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = "__non_existing_fname__";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/*
* attempt with lease provided, but
@@ -1114,7 +1149,9 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
ls.lease_key.data[0]++;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/* restore the correct lease key */
ls.lease_key.data[0]--;
@@ -1134,7 +1171,9 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
io.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
/*
* Now for a succeeding reconnect:
@@ -1154,7 +1193,8 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
@@ -1219,7 +1259,8 @@ bool test_durable_v2_open_reopen2_lease(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
@@ -1295,7 +1336,8 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
io.in.timeout = UINT32_MAX;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h = io.out.file.handle;
h = &_h;
CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1328,19 +1370,25 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
io.in.fname = "";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = "__non_existing_fname__";
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
ZERO_STRUCT(io);
io.in.fname = fname;
io.in.durable_handle_v2 = h;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/*
* attempt with lease provided, but
@@ -1357,7 +1405,9 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
ls.lease_key.data[0]++;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done, "Status is wrong");
/* restore the correct lease key */
ls.lease_key.data[0]--;
@@ -1378,7 +1428,9 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
io.in.oplock_level = SMB2_OPLOCK_LEVEL_LEASE;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
/*
* Now for a succeeding reconnect:
@@ -1398,7 +1450,8 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
@@ -1464,7 +1517,8 @@ bool test_durable_v2_open_reopen2_lease_v2(struct torture_context *tctx,
h = NULL;
status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
CHECK_VAL(io.out.durable_open, false);
CHECK_VAL(io.out.durable_open_v2, false); /* no dh2q response blob */
@@ -1533,7 +1587,8 @@ bool test_durable_v2_open_app_instance(struct torture_context *tctx,
io1.in.timeout = UINT32_MAX;
status = smb2_create(tree1, mem_ctx, &io1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h1 = io1.out.file.handle;
h1 = &_h1;
CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1560,7 +1615,8 @@ bool test_durable_v2_open_app_instance(struct torture_context *tctx,
io2.in.timeout = UINT32_MAX;
status = smb2_create(tree2, mem_ctx, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
_h2 = io2.out.file.handle;
h2 = &_h2;
CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
@@ -1573,7 +1629,8 @@ bool test_durable_v2_open_app_instance(struct torture_context *tctx,
CHECK_VAL(break_info.count, 0);
status = smb2_util_close(tree1, *h1);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
h1 = NULL;
done:
--
1.9.1
>From 7a65e4e36def3895ae5e160ae02a00d674647a96 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 13:05:36 +1200
Subject: [PATCH 11/14] Replace CHECK_STATUS macro in delete-on-close.c
In contrast to most of the other smb torture files, delete-on-close.c
uses a straightforward "return False" rather than a "goto done", so the
replacement macro is torture_assert_ntstatus_equal().
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/delete-on-close.c | 68 +++++++++++++++++++++-------------
1 file changed, 42 insertions(+), 26 deletions(-)
diff --git a/source4/torture/smb2/delete-on-close.c b/source4/torture/smb2/delete-on-close.c
index a12c2ab..6ba8ea6 100644
--- a/source4/torture/smb2/delete-on-close.c
+++ b/source4/torture/smb2/delete-on-close.c
@@ -31,14 +31,6 @@
#define DNAME "test_dir"
#define FNAME DNAME "\\test_create.dat"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, \
- "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- return false; \
- }} while (0)
-
static bool create_dir(struct torture_context *tctx, struct smb2_tree *tree)
{
NTSTATUS status;
@@ -70,7 +62,8 @@ static bool create_dir(struct torture_context *tctx, struct smb2_tree *tree)
io.in.security_flags = 0;
io.in.fname = DNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -78,7 +71,8 @@ static bool create_dir(struct torture_context *tctx, struct smb2_tree *tree)
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -110,7 +104,8 @@ static bool create_dir(struct torture_context *tctx, struct smb2_tree *tree)
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, handle);
@@ -148,7 +143,8 @@ static bool set_dir_delete_perms(struct torture_context *tctx, struct smb2_tree
io.in.security_flags = 0;
io.in.fname = DNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -156,7 +152,8 @@ static bool set_dir_delete_perms(struct torture_context *tctx, struct smb2_tree
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -189,7 +186,8 @@ static bool set_dir_delete_perms(struct torture_context *tctx, struct smb2_tree
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, handle);
@@ -227,7 +225,8 @@ static bool test_doc_overwrite_if(struct torture_context *tctx, struct smb2_tree
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -244,7 +243,9 @@ static bool test_doc_overwrite_if(struct torture_context *tctx, struct smb2_tree
torture_comment(tctx, "We expect NT_STATUS_OBJECT_NAME_NOT_FOUND\n");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
return true;
}
@@ -281,7 +282,8 @@ static bool test_doc_overwrite_if_exist(struct torture_context *tctx, struct smb
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -296,7 +298,9 @@ static bool test_doc_overwrite_if_exist(struct torture_context *tctx, struct smb
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -334,7 +338,8 @@ static bool test_doc_create(struct torture_context *tctx, struct smb2_tree *tree
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -351,7 +356,9 @@ static bool test_doc_create(struct torture_context *tctx, struct smb2_tree *tree
torture_comment(tctx, "We expect NT_STATUS_OBJECT_NAME_NOT_FOUND\n");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
return true;
}
@@ -387,7 +394,8 @@ static bool test_doc_create_exist(struct torture_context *tctx, struct smb2_tree
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -403,7 +411,9 @@ static bool test_doc_create_exist(struct torture_context *tctx, struct smb2_tree
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_COLLISION,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -441,7 +451,8 @@ static bool test_doc_create_if(struct torture_context *tctx, struct smb2_tree *t
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -458,7 +469,9 @@ static bool test_doc_create_if(struct torture_context *tctx, struct smb2_tree *t
torture_comment(tctx, "We expect NT_STATUS_OBJECT_NAME_NOT_FOUND\n");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
return true;
}
@@ -494,7 +507,8 @@ static bool test_doc_create_if_exist(struct torture_context *tctx, struct smb2_t
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
@@ -509,7 +523,9 @@ static bool test_doc_create_if_exist(struct torture_context *tctx, struct smb2_t
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
--
1.9.1
>From 74ef44127732ecef7379724969eaa37bc26ef7f2 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 14:10:18 +1200
Subject: [PATCH 12/14] Replace CHECK_STATUS macro in create.c
Unlike most of the other smb torture files (but like delete-on-close.c)
create.c uses "return False" in the CHECK_STATUS macro rather than
"goto done", so the replacement macro is torture_assert_ntstatus_equal().
Unlike delete-on-close.c, however, this file does have functions that
do have "done:" labels and clean-up blocks, so it probably should be using
the _goto varient in those places.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/create.c | 394 ++++++++++++++++++++++++++++--------------
1 file changed, 265 insertions(+), 129 deletions(-)
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index 44650b5..9a71386 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -37,14 +37,6 @@
#define FNAME "test_create.dat"
#define DNAME "smb2_open"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, \
- "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- return false; \
- }} while (0)
-
#define CHECK_EQUAL(v, correct) do { \
if (v != correct) { \
torture_result(tctx, TORTURE_FAIL, \
@@ -61,7 +53,8 @@
finfo.all_info.level = RAW_FILEINFO_ALL_INFORMATION; \
finfo.all_info.in.file.handle = h1; \
status = smb2_getinfo_file(tree, tctx, &finfo); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, \
+ "Status is wrong"); \
t1 = t & ~1; \
t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \
if (abs(t1-t2) > 2) { \
@@ -79,7 +72,8 @@
finfo.all_info.level = RAW_FILEINFO_ALL_INFORMATION; \
finfo.all_info.in.file.handle = h1; \
status = smb2_getinfo_file(tree, tctx, &finfo); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, \
+ "Status is wrong"); \
t2 = finfo.all_info.out.field; \
if (abs(t-t2) > 20000) { \
torture_result(tctx, TORTURE_FAIL, \
@@ -95,7 +89,8 @@
finfo.all_info.level = RAW_FILEINFO_ALL_INFORMATION; \
finfo.all_info.in.file.handle = h1; \
status = smb2_getinfo_file(tree, tctx, &finfo); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, \
+ "Status is wrong"); \
if ((v) != (finfo.all_info.out.field)) { \
torture_result(tctx, TORTURE_FAIL, \
"(%s) wrong value for field %s 0x%x - 0x%x\n", \
@@ -150,38 +145,52 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
io.in.create_options = 0xF0000000;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
io.in.create_options = 0;
io.in.file_attributes = FILE_ATTRIBUTE_DEVICE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
io.in.file_attributes = FILE_ATTRIBUTE_VOLUME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
io.in.create_disposition = NTCREATEX_DISP_OPEN;
io.in.file_attributes = FILE_ATTRIBUTE_VOLUME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
-
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
+
io.in.create_disposition = NTCREATEX_DISP_CREATE;
io.in.desired_access = 0x08000000;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
io.in.desired_access = 0x04000000;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
io.in.file_attributes = 0;
io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
@@ -208,7 +217,9 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
} else if (NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
ok_mask |= 1<<i;
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OK,
+ "Status is wrong");
} else {
unexpected_mask |= 1<<i;
torture_comment(tctx,
@@ -237,9 +248,13 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
NT_STATUS_EQUAL(status, NT_STATUS_PRIVILEGE_NOT_HELD)) {
access_mask |= io.in.desired_access;
} else {
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OK,
+ "Status is wrong");
}
}
}
@@ -280,7 +295,9 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
file_attributes_set |= io.out.file_attr;
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OK,
+ "Status is wrong");
} else {
unexpected_mask |= 1<<i;
torture_comment(tctx,
@@ -307,10 +324,12 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
"FILE_ATTRIBUTE_ENCRYPTED returned %s\n",
nt_errstr(status));
} else {
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_EQUAL(io.out.file_attr, (FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_ARCHIVE));
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
}
smb2_deltree(tree, FNAME);
@@ -325,30 +344,36 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
io.in.create_options = 0;
io.in.fname = FNAME ":stream1";
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
io.in.fname = FNAME;
io.in.file_attributes = 0x8040;
io.in.share_access =
NTCREATEX_SHARE_ACCESS_READ;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
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, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
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, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_EQUAL(q.access_information.out.access_flags, io.in.desired_access);
io.in.file_attributes = 0;
@@ -356,8 +381,10 @@ static bool test_create_gentest(struct torture_context *tctx, struct smb2_tree *
io.in.query_maximal_access = false;
io.in.share_access = 0;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
-
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
+
smb2_deltree(tree, FNAME);
return true;
@@ -389,10 +416,12 @@ static bool test_create_blob(struct torture_context *tctx, struct smb2_tree *tre
io.in.fname = FNAME;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing alloc size\n");
/* FIXME We use 1M cause that's the rounded size of Samba.
@@ -400,153 +429,194 @@ static bool test_create_blob(struct torture_context *tctx, struct smb2_tree *tre
* correctly. */
io.in.alloc_size = 0x00100000;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_EQUAL(io.out.alloc_size, io.in.alloc_size);
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing durable open\n");
io.in.durable_open = true;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing query maximal access\n");
io.in.query_maximal_access = true;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_EQUAL(io.out.maximal_access, 0x001f01ff);
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing timewarp\n");
io.in.timewarp = 10000;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
io.in.timewarp = 0;
torture_comment(tctx, "Testing query_on_disk\n");
io.in.query_on_disk_id = true;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing unknown tag\n");
status = smb2_create_blob_add(tctx, &io.in.blobs,
"FooO", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing bad tag length 0\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"x", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
torture_comment(tctx, "Testing bad tag length 1\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"x", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
torture_comment(tctx, "Testing bad tag length 2\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
torture_comment(tctx, "Testing bad tag length 3\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 4\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 5\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 6\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 7\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 8\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 16\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxxxxxxxxxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 17\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxxxxxxxxxxxxx", data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "Testing tag length 34\n");
ZERO_STRUCT(io.in.blobs);
status = smb2_create_blob_add(tctx, &io.in.blobs,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
data_blob(NULL, 0));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
smb2_deltree(tree, FNAME);
-
+
return true;
}
@@ -597,7 +667,8 @@ static bool test_create_acl_ext(struct torture_context *tctx, struct smb2_tree *
torture_comment(tctx, "basic create\n");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
q.query_secdesc.in.file.handle = io.out.file.handle;
@@ -606,13 +677,16 @@ static bool test_create_acl_ext(struct torture_context *tctx, struct smb2_tree *
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
sd = q.query_secdesc.out.sd;
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = delete_func(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "adding a new ACE\n");
test_sid = dom_sid_parse_talloc(tctx, SID_NT_AUTHENTICATED_USERS);
@@ -623,49 +697,59 @@ static bool test_create_acl_ext(struct torture_context *tctx, struct smb2_tree *
ace.trustee = *test_sid;
status = security_descriptor_dacl_add(sd, &ace);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "creating a file with an initial ACL\n");
io.in.sec_desc = sd;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
FAIL_UNLESS(smb2_util_verify_sd(tctx, tree, io.out.file.handle, sd));
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = delete_func(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "creating with attributes\n");
io.in.sec_desc = NULL;
io.in.file_attributes = attrib;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
FAIL_UNLESS(smb2_util_verify_attrib(tctx, tree, io.out.file.handle, attrib));
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = delete_func(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "creating with attributes and ACL\n");
io.in.sec_desc = sd;
io.in.file_attributes = attrib;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
FAIL_UNLESS(smb2_util_verify_sd(tctx, tree, io.out.file.handle, sd));
FAIL_UNLESS(smb2_util_verify_attrib(tctx, tree, io.out.file.handle, attrib));
-
+
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = delete_func(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "creating with attributes, ACL and owner\n");
sd = security_descriptor_dacl_create(tctx,
@@ -679,16 +763,19 @@ static bool test_create_acl_ext(struct torture_context *tctx, struct smb2_tree *
io.in.sec_desc = sd;
io.in.file_attributes = attrib;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
FAIL_UNLESS(smb2_util_verify_sd(tctx, tree, io.out.file.handle, sd));
FAIL_UNLESS(smb2_util_verify_attrib(tctx, tree, io.out.file.handle, attrib));
done:
status = smb2_util_close(tree, io.out.file.handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = delete_func(tree, FNAME);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
return ret;
}
@@ -734,7 +821,8 @@ static bool test_smb2_open(struct torture_context *tctx,
smb2_util_rmdir(tree, dname);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
ZERO_STRUCT(io.smb2);
/* reasonable default parameters */
@@ -789,7 +877,8 @@ static bool test_smb2_open(struct torture_context *tctx,
io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, 0);
@@ -807,13 +896,15 @@ static bool test_smb2_open(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
status = smb2_create_complex_file(tree, fname, &h1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
smb2_util_close(tree, h1);
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, 0);
@@ -847,7 +938,8 @@ static bool test_smb2_open(struct torture_context *tctx,
io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, 0);
@@ -894,7 +986,8 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx,
smb2_util_unlink(tree, fname);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
ZERO_STRUCT(io.smb2);
io.generic.level = RAW_OPEN_SMB2;
@@ -911,10 +1004,12 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx,
io.smb2.in.fname = fname;
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
status = smb2_util_write(tree, io.smb2.out.file.handle, &b, 0, 1);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
ZERO_STRUCT(io2.smb2);
io2.smb2.level = RAW_LOCK_SMB2;
@@ -928,7 +1023,8 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx,
SMB2_LOCK_FLAG_FAIL_IMMEDIATELY;
io2.smb2.in.locks = &lock[0];
status = smb2_lock(tree, &(io2.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
ZERO_STRUCT(io1.smb2);
io1.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
@@ -944,7 +1040,8 @@ static bool test_smb2_open_brlocked(struct torture_context *tctx,
io1.smb2.in.fname = fname;
status = smb2_create(tree, tctx, &(io1.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
smb2_util_close(tree, io.smb2.out.file.handle);
smb2_util_close(tree, io1.smb2.out.file.handle);
@@ -1095,7 +1192,8 @@ static bool test_smb2_open_for_delete(struct torture_context *tctx,
smb2_deltree(tree, fname);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
/* reasonable default parameters */
ZERO_STRUCT(io.smb2);
@@ -1114,7 +1212,8 @@ static bool test_smb2_open_for_delete(struct torture_context *tctx,
/* Create the readonly file. */
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, 0);
@@ -1131,7 +1230,8 @@ static bool test_smb2_open_for_delete(struct torture_context *tctx,
NTCREATEX_SHARE_ACCESS_DELETE;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, tctx, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
smb2_util_unlink(tree, fname);
@@ -1172,7 +1272,9 @@ static bool test_smb2_leading_slash(struct torture_context *tctx,
io.smb2.in.fname = dnameslash;
status = smb2_create(tree, tree, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "Status is wrong");
smb2_deltree(tree, dnameslash);
return ret;
@@ -1198,7 +1300,8 @@ static bool test_smb2_impersonation_level(struct torture_context *tctx,
smb2_util_rmdir(tree, DNAME);
status = torture_smb2_testdir(tree, DNAME, &h);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
ZERO_STRUCT(io.smb2);
io.generic.level = RAW_OPEN_SMB2;
@@ -1216,7 +1319,9 @@ static bool test_smb2_impersonation_level(struct torture_context *tctx,
io.smb2.in.create_flags = 0;
status = smb2_create(tree, tree, &(io.smb2));
- CHECK_STATUS(status, NT_STATUS_BAD_IMPERSONATION_LEVEL);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_BAD_IMPERSONATION_LEVEL,
+ "Status is wrong");
smb2_util_close(tree, h);
smb2_util_unlink(tree, fname);
@@ -1245,7 +1350,8 @@ static bool test_create_acl_dir(struct torture_context *tctx,
_q.access_information.level = RAW_FILEINFO_ACCESS_INFORMATION; \
_q.access_information.in.file.handle = (_fh); \
status = smb2_getinfo_file(tree, tctx, &_q); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK, \
+ "Status is wrong"); \
if (_q.access_information.out.access_flags != (flags)) { \
torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect access_flags 0x%08x - should be 0x%08x\n", \
__location__, _q.access_information.out.access_flags, (flags)); \
@@ -1297,7 +1403,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "creating a file with a empty sd\n");
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -1308,7 +1415,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
/*
* Testing the created DACL,
@@ -1332,7 +1440,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
s.set_secdesc.in.secinfo_flags = SECINFO_DACL;
s.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &s);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "get the sd\n");
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
@@ -1342,7 +1451,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
/* Testing the modified DACL */
if (!(q.query_secdesc.out.sd->type & SEC_DESC_DACL_PRESENT)) {
@@ -1359,7 +1469,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for read control\n");
io.in.desired_access = SEC_STD_READ_CONTROL;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_STD_READ_CONTROL);
smb2_util_close(tree, io.out.file.handle);
@@ -1367,7 +1478,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for write\n");
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_FILE_WRITE_DATA);
smb2_util_close(tree, io.out.file.handle);
@@ -1375,7 +1487,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for read\n");
io.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_FILE_READ_DATA);
smb2_util_close(tree, io.out.file.handle);
@@ -1383,7 +1496,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for generic write\n");
io.in.desired_access = SEC_GENERIC_WRITE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_RIGHTS_FILE_WRITE);
smb2_util_close(tree, io.out.file.handle);
@@ -1391,7 +1505,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for generic read\n");
io.in.desired_access = SEC_GENERIC_READ;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_RIGHTS_FILE_READ);
smb2_util_close(tree, io.out.file.handle);
@@ -1407,7 +1522,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
s.set_secdesc.in.secinfo_flags = SECINFO_DACL;
s.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &s);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "get the sd\n");
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
@@ -1417,7 +1533,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
/* Testing the modified DACL */
if (!(q.query_secdesc.out.sd->type & SEC_DESC_DACL_PRESENT)) {
@@ -1438,7 +1555,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
torture_comment(tctx, "try open for read control\n");
io.in.desired_access = SEC_STD_READ_CONTROL;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_STD_READ_CONTROL);
smb2_util_close(tree, io.out.file.handle);
@@ -1447,36 +1565,52 @@ static bool test_create_null_dacl(struct torture_context *tctx,
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
}
torture_comment(tctx, "try open for read => access_denied\n");
io.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
}
torture_comment(tctx, "try open for generic write => access_denied\n");
io.in.desired_access = SEC_GENERIC_WRITE;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
}
torture_comment(tctx, "try open for generic read => access_denied\n");
io.in.desired_access = SEC_GENERIC_READ;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ "Status is wrong");
}
torture_comment(tctx, "set empty sd\n");
@@ -1488,7 +1622,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
s.set_secdesc.in.secinfo_flags = SECINFO_DACL;
s.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &s);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
torture_comment(tctx, "get the sd\n");
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
@@ -1498,7 +1633,8 @@ static bool test_create_null_dacl(struct torture_context *tctx,
SECINFO_GROUP |
SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OK,
+ "Status is wrong");
/* Testing the modified DACL */
if (!(q.query_secdesc.out.sd->type & SEC_DESC_DACL_PRESENT)) {
--
1.9.1
>From ec05f37cf7adef59f138deef8142a35331bb087f Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 14:15:20 +1200
Subject: [PATCH 13/14] Replace CHECK_STATUS macro in compound.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/compound.c | 157 ++++++++++++++++++++++++++--------------
1 file changed, 101 insertions(+), 56 deletions(-)
diff --git a/source4/torture/smb2/compound.c b/source4/torture/smb2/compound.c
index a502103..5ebc358 100644
--- a/source4/torture/smb2/compound.c
+++ b/source4/torture/smb2/compound.c
@@ -26,14 +26,6 @@
#include "torture/smb2/proto.h"
#include "../libcli/smb/smbXcli_base.h"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
- nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
torture_result(tctx, TORTURE_FAIL, \
@@ -192,10 +184,12 @@ static bool test_compound_break(struct torture_context *tctx,
req[1] = smb2_getinfo_send(tree, &gf);
status = smb2_create_recv(req[0], tree, &io2);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_getinfo_recv(req[1], tree, &gf);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
@@ -269,9 +263,11 @@ static bool test_compound_related1(struct torture_context *tctx,
req[1] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
TALLOC_FREE(tree->smbXcli);
tree->smbXcli = saved_tcon;
@@ -351,15 +347,20 @@ static bool test_compound_related2(struct torture_context *tctx,
req[4] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[3], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[4], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
TALLOC_FREE(tree->smbXcli);
tree->smbXcli = saved_tcon;
@@ -427,14 +428,18 @@ static bool test_compound_related3(struct torture_context *tctx,
req[2] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_ioctl_recv(req[1], tree, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret = true;
done:
@@ -466,11 +471,13 @@ static bool test_compound_padding(struct torture_context *tctx,
NTCREATEX_SHARE_ACCESS_WRITE|
NTCREATEX_SHARE_ACCESS_DELETE;
status = smb2_create(tree, tctx, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = cr.out.file.handle;
status = smb2_util_write(tree, h, "123", 0, 3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h);
@@ -485,11 +492,13 @@ static bool test_compound_padding(struct torture_context *tctx,
NTCREATEX_SHARE_ACCESS_WRITE|
NTCREATEX_SHARE_ACCESS_DELETE;
status = smb2_create(tree, tctx, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = cr.out.file.handle;
status = smb2_util_write(tree, h, "456", 0, 3);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h);
@@ -519,7 +528,8 @@ static bool test_compound_padding(struct torture_context *tctx,
req[1] = smb2_read_send(tree, &r);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* We must do a manual smb2_request_receive() in order to be
@@ -539,7 +549,8 @@ static bool test_compound_padding(struct torture_context *tctx,
CHECK_VALUE(req[1]->in.body_size, 24);
status = smb2_read_recv(req[1], tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, cr.out.file.handle);
@@ -569,7 +580,8 @@ static bool test_compound_padding(struct torture_context *tctx,
req[1] = smb2_read_send(tree, &r);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* We must do a manual smb2_request_receive() in order to be
@@ -589,7 +601,8 @@ static bool test_compound_padding(struct torture_context *tctx,
CHECK_VALUE(req[1]->in.body_size, 24);
status = smb2_read_recv(req[1], tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
h = cr.out.file.handle;
@@ -627,9 +640,11 @@ static bool test_compound_padding(struct torture_context *tctx,
CHECK_VALUE(req[1]->in.body_size, 24);
status = smb2_read_recv(req[0], tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_read_recv(req[1], tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* now try a single read from the stream and verify there's no padding
@@ -659,12 +674,14 @@ static bool test_compound_padding(struct torture_context *tctx,
CHECK_VALUE(req[0]->in.body_size, 19);
status = smb2_read_recv(req[0], tree, &r);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, h);
status = smb2_util_unlink(tree, fname);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
ret = true;
done:
@@ -721,15 +738,20 @@ static bool test_compound_unrelated1(struct torture_context *tctx,
req[4] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[3], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[4], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
smb2_util_unlink(tree, fname);
done:
@@ -790,11 +812,16 @@ static bool test_compound_invalid1(struct torture_context *tctx,
status = smb2_create_recv(req[0], tree, &cr);
/* TODO: check why this fails with --signing=required */
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
smb2_util_unlink(tree, fname);
done:
@@ -872,15 +899,23 @@ static bool test_compound_invalid2(struct torture_context *tctx,
req[4] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[3], &cl);
- CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_USER_SESSION_DELETED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[4], &cl);
- CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_INVALID_PARAMETER,
+ ret, done, "Status is wrong");
TALLOC_FREE(tree->smbXcli);
tree->smbXcli = saved_tcon;
@@ -944,15 +979,20 @@ static bool test_compound_invalid3(struct torture_context *tctx,
req[4] = smb2_close_send(tree, &cl);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[1], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[2], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[3], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
status = smb2_close_recv(req[4], &cl);
- CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_FILE_CLOSED,
+ ret, done, "Status is wrong");
smb2_util_unlink(tree, fname);
done:
@@ -1012,11 +1052,13 @@ static bool test_compound_interim1(struct torture_context *tctx,
req[1] = smb2_notify_send(tree, &nt);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_cancel(req[1]);
status = smb2_notify_recv(req[1], tree, &nt);
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_CANCELLED,
+ ret, done, "Status is wrong");
smb2_util_close(tree, cr.out.file.handle);
@@ -1088,13 +1130,16 @@ static bool test_compound_interim2(struct torture_context *tctx,
req[2] = smb2_getinfo_send(tree, &gf);
status = smb2_create_recv(req[0], tree, &cr);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
status = smb2_notify_recv(req[1], tree, &nt);
- CHECK_STATUS(status, NT_STATUS_INTERNAL_ERROR);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_INTERNAL_ERROR,
+ ret, done, "Status is wrong");
status = smb2_getinfo_recv(req[2], tree, &gf);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, cr.out.file.handle);
--
1.9.1
>From 46c06833bbb1fc805faeedbe5dc7118cb10bebc5 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu, 25 Jun 2015 14:25:34 +1200
Subject: [PATCH 14/14] Replace CHECK_STATUS macro in acls.c
Instead we use torture_assert_ntstatus_equal_goto() from
lib/torture/torture.h.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
---
source4/torture/smb2/acls.c | 338 +++++++++++++++++++++++++++++++-------------
1 file changed, 240 insertions(+), 98 deletions(-)
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index 37052c6..17962ed 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -28,14 +28,6 @@
#include "libcli/security/security.h"
#include "librpc/gen_ndr/ndr_security.h"
-#define CHECK_STATUS(status, correct) do { \
- if (!NT_STATUS_EQUAL(status, correct)) { \
- torture_result(tctx, TORTURE_FAIL, "(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
- ret = false; \
- goto done; \
- }} while (0)
-
#define BASEDIR "smb2-testsd"
#define CHECK_ACCESS_IGNORE SEC_STD_SYNCHRONIZE
@@ -45,7 +37,8 @@
_q.access_information.level = RAW_FILEINFO_ACCESS_INFORMATION; \
_q.access_information.in.file.handle = (_fh); \
status = smb2_getinfo_file(tree, tctx, &_q); \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, \
+ ret, done, "Status should be OK"); \
/* Handle a Vista bug where SEC_STD_SYNCHRONIZE doesn't come back. */ \
if ((((flags) & CHECK_ACCESS_IGNORE) == CHECK_ACCESS_IGNORE) && \
((_q.access_information.out.access_flags & CHECK_ACCESS_IGNORE) != CHECK_ACCESS_IGNORE)) { \
@@ -122,7 +115,8 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
io.in.fname = fname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -130,7 +124,8 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -150,27 +145,36 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for write\n");
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for read\n");
io.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for generic write\n");
io.in.desired_access = SEC_GENERIC_WRITE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for generic read\n");
io.in.desired_access = SEC_GENERIC_READ;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "set a sec desc allowing no write by owner\n");
sd = security_descriptor_dacl_create(tctx,
@@ -186,22 +190,27 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "check that sd has been mapped correctly\n");
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd);
torture_comment(tctx, "try open for write\n");
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for read\n");
io.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_FILE_READ_DATA);
smb2_util_close(tree, io.out.file.handle);
@@ -209,12 +218,15 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
torture_comment(tctx, "try open for generic write\n");
io.in.desired_access = SEC_GENERIC_WRITE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for generic read\n");
io.in.desired_access = SEC_GENERIC_READ;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_RIGHTS_FILE_READ);
smb2_util_close(tree, io.out.file.handle);
@@ -230,7 +242,8 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "check that generic read has been mapped correctly\n");
sd2 = security_descriptor_dacl_create(tctx,
@@ -242,18 +255,22 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
NULL);
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
torture_comment(tctx, "try open for write\n");
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for read\n");
io.in.desired_access = SEC_FILE_READ_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
SEC_FILE_READ_DATA);
smb2_util_close(tree, io.out.file.handle);
@@ -261,12 +278,15 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
torture_comment(tctx, "try open for generic write\n");
io.in.desired_access = SEC_GENERIC_WRITE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try open for generic read\n");
io.in.desired_access = SEC_GENERIC_READ;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle, SEC_RIGHTS_FILE_READ);
smb2_util_close(tree, io.out.file.handle);
@@ -274,7 +294,8 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
torture_comment(tctx, "put back original sd\n");
set.set_secdesc.in.sd = sd_orig;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
@@ -351,7 +372,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
io.in.security_flags = 0;
io.in.fname = fname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -359,7 +381,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -416,7 +439,9 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
sd2 = security_descriptor_dacl_create(tctx,
0, owner_sid, NULL,
@@ -427,12 +452,16 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
NULL);
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
expected_mask | file_mappings[i].specific_bits);
smb2_util_close(tree, io.out.file.handle);
@@ -457,7 +486,9 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
sd2 = security_descriptor_dacl_create(tctx,
0, SID_NT_ANONYMOUS, NULL,
@@ -468,12 +499,16 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
NULL);
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
expected_mask_anon | file_mappings[i].specific_bits);
smb2_util_close(tree, io.out.file.handle);
@@ -482,7 +517,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
torture_comment(tctx, "put back original sd\n");
set.set_secdesc.in.sd = sd_orig;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, handle);
smb2_util_unlink(tree, fname);
@@ -508,7 +544,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
io.in.security_flags = 0;
io.in.fname = fname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -516,7 +553,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -573,7 +611,9 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
sd2 = security_descriptor_dacl_create(tctx,
0, owner_sid, NULL,
@@ -584,12 +624,16 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
NULL);
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
expected_mask | dir_mappings[i].specific_bits);
smb2_util_close(tree, io.out.file.handle);
@@ -614,7 +658,9 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
sd2 = security_descriptor_dacl_create(tctx,
0, SID_NT_ANONYMOUS, NULL,
@@ -625,12 +671,16 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
NULL);
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle,
expected_mask_anon | dir_mappings[i].specific_bits);
smb2_util_close(tree, io.out.file.handle);
@@ -639,7 +689,8 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
torture_comment(tctx, "put back original sd\n");
set.set_secdesc.in.sd = sd_orig;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, handle);
smb2_util_unlink(tree, fname);
@@ -694,7 +745,8 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
io.in.security_flags = 0;
io.in.fname = fname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -702,7 +754,8 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -745,7 +798,8 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
expected_bits = SEC_FILE_WRITE_DATA | SEC_FILE_READ_ATTRIBUTE;
@@ -758,7 +812,10 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
torture_warning(tctx, "failed with access mask 0x%08x of expected 0x%08x\n",
bit, expected_bits);
}
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_ACCESS_FLAGS(io.out.file.handle, bit);
smb2_util_close(tree, io.out.file.handle);
} else {
@@ -767,14 +824,18 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
"expected 0x%08x - should fail\n",
bit, expected_bits);
}
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done,
+ "Status is wrong");
}
}
torture_comment(tctx, "put back original sd\n");
set.set_secdesc.in.sd = sd_orig;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
done:
smb2_util_close(tree, handle);
@@ -933,7 +994,8 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
io.in.fname = dname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -941,7 +1003,8 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -995,17 +1058,23 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
io.in.fname = fname1;
io.in.create_options = 0;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
handle2 = io.out.file.handle;
q.query_secdesc.in.file.handle = handle2;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
smb2_util_close(tree, handle2);
smb2_util_unlink(tree, fname1);
@@ -1046,12 +1115,16 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
io.in.fname = fname2;
io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
handle2 = io.out.file.handle;
q.query_secdesc.in.file.handle = handle2;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
smb2_util_close(tree, handle2);
smb2_util_rmdir(tree, fname2);
@@ -1143,14 +1216,16 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/* Check DACL we just set. */
torture_comment(tctx, "checking new sd\n");
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd);
io.in.fname = fname1;
@@ -1158,14 +1233,16 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
io.in.desired_access = SEC_RIGHTS_FILE_ALL;
io.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
CHECK_ACCESS_FLAGS(handle2, SEC_RIGHTS_FILE_ALL);
q.query_secdesc.in.file.handle = handle2;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, handle2);
sd2 = security_descriptor_dacl_create(tctx,
@@ -1189,9 +1266,15 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
} else {
if (torture_setting_bool(tctx, "hide_on_access_denied",
false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done,
+ "Status is wrong");
}
}
@@ -1200,9 +1283,15 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
io.in.desired_access = SEC_RIGHTS_FILE_ALL & ~SEC_FILE_EXECUTE;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done,
+ "Status is wrong");
}
torture_comment(tctx, "and with full permissions again\n");
@@ -1210,14 +1299,21 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
io.in.desired_access = SEC_RIGHTS_FILE_ALL;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done,
+ "Status is wrong");
}
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
CHECK_ACCESS_FLAGS(handle2, SEC_FILE_WRITE_DATA);
smb2_util_close(tree, handle2);
@@ -1228,21 +1324,29 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd_orig;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
smb2_util_close(tree, handle);
io.in.desired_access = SEC_RIGHTS_FILE_ALL;
status = smb2_create(tree, tctx, &io);
if (torture_setting_bool(tctx, "hide_on_access_denied", false)) {
- CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OBJECT_NAME_NOT_FOUND,
+ ret, done,
+ "Status is wrong");
} else {
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done,
+ "Status is wrong");
}
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
CHECK_ACCESS_FLAGS(handle2, SEC_FILE_WRITE_DATA);
smb2_util_close(tree, handle2);
@@ -1359,7 +1463,8 @@ static bool test_inheritance_flags(struct torture_context *tctx,
torture_comment(tctx, "creating initial directory %s\n", dname);
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "getting original sd\n");
@@ -1367,7 +1472,8 @@ static bool test_inheritance_flags(struct torture_context *tctx,
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -1395,7 +1501,9 @@ static bool test_inheritance_flags(struct torture_context *tctx,
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
/*
* Check DACL we just set, except change the bits to what they
@@ -1412,7 +1520,9 @@ static bool test_inheritance_flags(struct torture_context *tctx,
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd);
/* Create file. */
@@ -1423,14 +1533,18 @@ static bool test_inheritance_flags(struct torture_context *tctx,
io.in.desired_access = SEC_RIGHTS_FILE_ALL;
io.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
handle2 = io.out.file.handle;
CHECK_ACCESS_FLAGS(handle2, SEC_RIGHTS_FILE_ALL);
q.query_secdesc.in.file.handle = handle2;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
torture_comment(tctx, " checking sd on file %s\n", fname1);
sd2 = security_descriptor_dacl_create(tctx,
@@ -1467,7 +1581,10 @@ static bool test_inheritance_flags(struct torture_context *tctx,
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd2;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
/* Check DACL we just set. */
sd2->type &= ~SEC_DESC_DACL_AUTO_INHERIT_REQ;
@@ -1477,7 +1594,10 @@ static bool test_inheritance_flags(struct torture_context *tctx,
q.query_secdesc.in.file.handle = handle2;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
CHECK_SECURITY_DESCRIPTOR(q.query_secdesc.out.sd, sd2);
}
@@ -1531,7 +1651,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
io.in.fname = dname;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
torture_comment(tctx, "get the original sd\n");
@@ -1539,7 +1660,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
q.query_secdesc.in.file.handle = handle;
q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
status = smb2_getinfo_file(tree, tctx, &q);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
@@ -1560,7 +1682,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
set.set_secdesc.in.secinfo_flags = SECINFO_DACL;
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "create a file with an inherited acl\n");
io.in.fname = fname1;
@@ -1568,7 +1691,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
io.in.desired_access = SEC_FILE_READ_ATTRIBUTE;
io.in.create_disposition = NTCREATEX_DISP_CREATE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
smb2_util_close(tree, handle2);
@@ -1576,14 +1700,17 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
io.in.desired_access = SEC_FILE_WRITE_DATA;
io.in.create_disposition = NTCREATEX_DISP_OPEN;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
smb2_util_close(tree, handle2);
torture_comment(tctx, "try and access file with extra rights - should be denied\n");
io.in.desired_access = SEC_FILE_WRITE_DATA | SEC_FILE_EXECUTE;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
torture_comment(tctx, "update parent sd\n");
sd = security_descriptor_dacl_create(tctx,
@@ -1597,12 +1724,14 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
set.set_secdesc.in.sd = sd;
status = smb2_setinfo_file(tree, &set);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
torture_comment(tctx, "try and access file with base rights - should be OK\n");
io.in.desired_access = SEC_FILE_WRITE_DATA;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle2 = io.out.file.handle;
smb2_util_close(tree, handle2);
@@ -1616,7 +1745,9 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
if (NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
torture_comment(tctx, "Server does have dynamic inheritance\n");
}
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ torture_assert_ntstatus_equal_goto(tctx, status,
+ NT_STATUS_ACCESS_DENIED,
+ ret, done, "Status is wrong");
smb2_util_unlink(tree, fname1);
@@ -1639,10 +1770,15 @@ done:
#define CHECK_STATUS_FOR_BIT_ACTION(status, bits, action) do { \
if (!(bits & desired_64)) {\
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); \
+ torture_assert_ntstatus_equal_goto(tctx, status, \
+ NT_STATUS_ACCESS_DENIED, \
+ ret, done, \
+ "Status is wrong"); \
action; \
} else { \
- CHECK_STATUS(status, NT_STATUS_OK); \
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, \
+ ret, done, \
+ "Status is wrong"); \
} \
} while (0)
@@ -1731,11 +1867,13 @@ static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree *tree
io.in.fname = fname;
io.in.sec_desc = sd;
status = smb2_create(tree, tctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
handle = io.out.file.handle;
status = smb2_util_close(tree, handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done, "Status is wrong");
/*
* now try each access_mask bit and no bit at all in a loop
@@ -1758,7 +1896,9 @@ static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree *tree
fi.access_information.level = RAW_FILEINFO_ACCESS_INFORMATION;
fi.access_information.in.file.handle = handle;
status = smb2_getinfo_file(tree, tctx, &fi);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
granted = fi.access_information.out.access_flags;
/* test the owner */
@@ -1839,7 +1979,9 @@ static bool test_sd_get_set(struct torture_context *tctx, struct smb2_tree *tree
/* close the handle */
status = smb2_util_close(tree, handle);
- CHECK_STATUS(status, NT_STATUS_OK);
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK,
+ ret, done,
+ "Status is wrong");
next:
continue;
}
--
1.9.1
More information about the samba-technical
mailing list