summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorBjörn Baumbach <bb@sernet.de>2011-07-07 16:27:39 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-07 19:16:28 +0200
commit60873a9e48115e5bfb3c58cccd078c49d43c56bc (patch)
tree85f861a3d336d84f183e1ac09e0775dfaa2e42df /source3/torture
parent3cdf962d1ea2823e2a5200533685b3a627a00237 (diff)
downloadsamba-60873a9e48115e5bfb3c58cccd078c49d43c56bc.tar.gz
samba-60873a9e48115e5bfb3c58cccd078c49d43c56bc.tar.bz2
samba-60873a9e48115e5bfb3c58cccd078c49d43c56bc.zip
s3-torture: introduce check_both_error()
Check if the server produced the expected dos or nt error code like check_error(), but without a cli_state struct. Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 8f251b7f2b..2243fe6c0b 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -455,6 +455,40 @@ bool torture_close_connection(struct cli_state *c)
}
+/* check if the server produced the expected dos or nt error code */
+static bool check_both_error(int line, NTSTATUS status,
+ uint8 eclass, uint32 ecode, NTSTATUS nterr)
+{
+ if (NT_STATUS_IS_DOS(status)) {
+ uint8 cclass;
+ uint32 num;
+
+ /* Check DOS error */
+ 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",
+ (int)cclass, (int)num);
+ printf(" expected %d/%d %s (line=%d)\n",
+ (int)eclass, (int)ecode, nt_errstr(nterr), line);
+ return false;
+ }
+ } else {
+ /* Check NT error */
+ if (!NT_STATUS_EQUAL(nterr, status)) {
+ printf("unexpected error code %s\n",
+ nt_errstr(status));
+ printf(" expected %s (line=%d)\n",
+ nt_errstr(nterr), line);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
/* check if the server produced the expected error code */
static bool check_error(int line, struct cli_state *c,
uint8 eclass, uint32 ecode, NTSTATUS nterr)