diff options
author | Volker Lendecke <vl@samba.org> | 2011-07-27 21:51:45 +0200 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2011-07-27 23:07:50 +0200 |
commit | 94a2328367b2098bf5e125ddbd1e8c9bfde20efe (patch) | |
tree | e73abc60e9c093ac3289272b26683cee751f989c /source3/torture | |
parent | a7f8d9e798bd5cf4ff16382b45e20e4b2a4c0bf8 (diff) | |
download | samba-94a2328367b2098bf5e125ddbd1e8c9bfde20efe.tar.gz samba-94a2328367b2098bf5e125ddbd1e8c9bfde20efe.tar.bz2 samba-94a2328367b2098bf5e125ddbd1e8c9bfde20efe.zip |
s3: Avoid calls to cli_dos/nt_error in torture
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Jul 27 23:07:51 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 9b2e2cfb4d..90a906819c 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -503,16 +503,17 @@ static bool check_both_error(int line, NTSTATUS status, /* check if the server produced the expected error code */ -static bool check_error(int line, struct cli_state *c, +static bool check_error(int line, NTSTATUS status, uint8 eclass, uint32 ecode, NTSTATUS nterr) { - if (cli_is_dos_error(c)) { + if (NT_STATUS_IS_DOS(status)) { uint8 cclass; uint32 num; /* Check DOS error */ - cli_dos_error(c, &cclass, &num); + cclass = NT_STATUS_DOS_CLASS(status); + num = NT_STATUS_DOS_CODE(status); if (eclass != cclass || ecode != num) { printf("unexpected error code class=%d code=%d\n", @@ -524,12 +525,8 @@ static bool check_error(int line, struct cli_state *c, } } else { - NTSTATUS status; - /* Check NT error */ - status = cli_nt_error(c); - if (NT_STATUS_V(nterr) != NT_STATUS_V(status)) { printf("unexpected error code %s\n", nt_errstr(status)); @@ -2924,7 +2921,7 @@ static bool run_unlinktest(int dummy) printf("error: server allowed unlink on an open file\n"); correct = False; } else { - correct = check_error(__LINE__, cli, ERRDOS, ERRbadshare, + correct = check_error(__LINE__, status, ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION); } @@ -4877,9 +4874,9 @@ static bool run_opentest(int dummy) } /* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */ - cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2); + status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2); - if (check_error(__LINE__, cli1, ERRDOS, ERRnoaccess, + if (check_error(__LINE__, status, ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED)) { printf("correct error code ERRDOS/ERRnoaccess returned\n"); } @@ -4899,9 +4896,9 @@ static bool run_opentest(int dummy) } /* This will fail - but the error should be ERRshare. */ - cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2); + status = cli_open(cli1, fname, O_RDWR, DENY_ALL, &fnum2); - if (check_error(__LINE__, cli1, ERRDOS, ERRbadshare, + if (check_error(__LINE__, status, ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION)) { printf("correct error code ERRDOS/ERRbadshare returned\n"); } @@ -6015,23 +6012,25 @@ bool torture_chkpath_test(int dummy) status = cli_chkpath(cli, "\\chkpath.dir\\foo.txt"); if (!NT_STATUS_IS_OK(status)) { - ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, + ret = check_error(__LINE__, status, ERRDOS, ERRbadpath, NT_STATUS_NOT_A_DIRECTORY); } else { printf("* chkpath on a file should fail\n"); ret = False; } - if (!NT_STATUS_IS_OK(cli_chkpath(cli, "\\chkpath.dir\\bar.txt"))) { - ret = check_error(__LINE__, cli, ERRDOS, ERRbadfile, + status = cli_chkpath(cli, "\\chkpath.dir\\bar.txt"); + if (!NT_STATUS_IS_OK(status)) { + ret = check_error(__LINE__, status, ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND); } else { printf("* chkpath on a non existant file should fail\n"); ret = False; } - if (!NT_STATUS_IS_OK(cli_chkpath(cli, "\\chkpath.dir\\dirxx\\bar.txt"))) { - ret = check_error(__LINE__, cli, ERRDOS, ERRbadpath, + status = cli_chkpath(cli, "\\chkpath.dir\\dirxx\\bar.txt"); + if (!NT_STATUS_IS_OK(status)) { + ret = check_error(__LINE__, status, ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND); } else { printf("* chkpath on a non existent component should fail\n"); @@ -7171,8 +7170,8 @@ static bool run_uid_regression_test(int dummy) goto out; } else { /* Should be bad uid. */ - if (!check_error(__LINE__, cli, ERRSRV, ERRbaduid, - NT_STATUS_USER_SESSION_DELETED)) { + if (!check_error(__LINE__, status, ERRSRV, ERRbaduid, + NT_STATUS_USER_SESSION_DELETED)) { correct = false; goto out; } @@ -7205,7 +7204,7 @@ static bool run_uid_regression_test(int dummy) goto out; } else { /* Should be bad tid. */ - if (!check_error(__LINE__, cli, ERRSRV, ERRinvnid, + if (!check_error(__LINE__, status, ERRSRV, ERRinvnid, NT_STATUS_NETWORK_NAME_DELETED)) { correct = false; goto out; |