From 0342b69f36acdb9418f4b85ed48f3c6b78ef553f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 8 Jul 2011 13:34:38 +0200 Subject: [PATCH] s3:torture: use cli_is_nt/dos_error() in run_error_map_extract() Callers should avoid using cli->inbuf directly! metze --- source3/torture/torture.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index a6387c1484e..52ae4bb4405 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -6142,7 +6142,7 @@ static bool run_error_map_extract(int dummy) { uint32 error; - uint32 flgs2, errnum; + uint32 errnum; uint8 errclass; NTSTATUS nt_status; @@ -6207,29 +6207,27 @@ static bool run_error_map_extract(int dummy) { printf("/** Session setup succeeded. This shouldn't happen...*/\n"); } - flgs2 = SVAL(c_nt->inbuf,smb_flg2); - /* Case #1: 32-bit NT errors */ - if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) { - nt_status = NT_STATUS(IVAL(c_nt->inbuf,smb_rcls)); + if (cli_is_nt_error(c_nt)) { + nt_status = cli_nt_error(c_nt); } else { printf("/** Dos error on NT connection! (%s) */\n", cli_errstr(c_nt)); nt_status = NT_STATUS(0xc0000000); } - if (NT_STATUS_IS_OK(cli_session_setup(c_dos, user, - password, strlen(password), - password, strlen(password), - workgroup))) { + status = cli_session_setup(c_dos, user, + password, strlen(password), + password, strlen(password), + workgroup); + if (NT_STATUS_IS_OK(status)) { printf("/** Session setup succeeded. This shouldn't happen...*/\n"); } - flgs2 = SVAL(c_dos->inbuf,smb_flg2), errnum; /* Case #1: 32-bit NT errors */ - if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) { + if (!cli_is_dos_error(c_dos)) { printf("/** NT error on DOS connection! (%s) */\n", - cli_errstr(c_nt)); + cli_errstr(c_dos)); errnum = errclass = 0; } else { cli_dos_error(c_dos, &errclass, &errnum); -- 2.34.1