summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-09-04 11:52:42 +0000
committerAndrew Tridgell <tridge@samba.org>2001-09-04 11:52:42 +0000
commitcefa698c725c883c418b915b057e4ef023610a1d (patch)
tree141469486a32759f8eb6c396f76d1123f7dbc5e0
parented3fbafdd34af0f22c0f90c93718e887bae23dec (diff)
downloadsamba-cefa698c725c883c418b915b057e4ef023610a1d.tar.gz
samba-cefa698c725c883c418b915b057e4ef023610a1d.tar.bz2
samba-cefa698c725c883c418b915b057e4ef023610a1d.zip
fixed compilation of torture
(This used to be commit aaf538a83057150cc35e9032aff7a78e8f0c4dc2)
-rw-r--r--source3/torture/scanner.c84
-rw-r--r--source3/torture/torture.c8
2 files changed, 44 insertions, 48 deletions
diff --git a/source3/torture/scanner.c b/source3/torture/scanner.c
index 19505d257d..c5f6708408 100644
--- a/source3/torture/scanner.c
+++ b/source3/torture/scanner.c
@@ -32,25 +32,23 @@ look for a partial hit
****************************************************************************/
static void trans2_check_hit(char *format, int op, int level, NTSTATUS status)
{
- switch (status) {
- case NT_STATUS_INVALID_LEVEL:
- case NT_STATUS_NOT_IMPLEMENTED:
- case NT_STATUS_NOT_SUPPORTED:
- case NT_STATUS_UNSUCCESSFUL:
- case NT_STATUS_INVALID_INFO_CLASS:
- break;
- default:
+ if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_LEVEL) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_SUPPORTED) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_UNSUCCESSFUL) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
+ return;
+ }
#if VERBOSE
- printf("possible %s hit op=%3d level=%5d status=%s\n",
- format, op, level, get_nt_error_msg(status));
+ printf("possible %s hit op=%3d level=%5d status=%s\n",
+ format, op, level, get_nt_error_msg(status));
#endif
- }
}
/****************************************************************************
check for existance of a trans2 call
****************************************************************************/
-static uint32 try_trans2(struct cli_state *cli,
+static NTSTATUS try_trans2(struct cli_state *cli,
int op,
char *param, char *data,
int param_len, int data_len,
@@ -80,30 +78,30 @@ static uint32 try_trans2(struct cli_state *cli,
}
-static uint32 try_trans2_len(struct cli_state *cli,
+static NTSTATUS try_trans2_len(struct cli_state *cli,
char *format,
int op, int level,
char *param, char *data,
int param_len, int *data_len,
int *rparam_len, int *rdata_len)
{
- uint32 ret=0;
+ NTSTATUS ret=NT_STATUS_OK;
ret = try_trans2(cli, op, param, data, param_len,
sizeof(pstring), rparam_len, rdata_len);
#if VERBOSE
printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret));
#endif
- if (ret != 0) return ret;
+ if (!NT_STATUS_IS_OK(ret)) return ret;
*data_len = 0;
while (*data_len < sizeof(pstring)) {
ret = try_trans2(cli, op, param, data, param_len,
*data_len, rparam_len, rdata_len);
- if (ret == 0) break;
+ if (NT_STATUS_IS_OK(ret)) break;
*data_len += 2;
}
- if (ret == NT_STATUS_OK) {
+ if (NT_STATUS_IS_OK(ret)) {
printf("found %s level=%d data_len=%d rparam_len=%d rdata_len=%d\n",
format, level, *data_len, *rparam_len, *rdata_len);
} else {
@@ -132,7 +130,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
SSVAL(param, 0, level);
status = try_trans2_len(cli, "void", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a file descriptor */
param_len = 6;
@@ -141,7 +139,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
SSVAL(param, 4, 0);
status = try_trans2_len(cli, "fnum", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a notify style */
@@ -151,7 +149,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
SSVAL(param, 4, level);
status = try_trans2_len(cli, "notify", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a file name */
param_len = 6;
@@ -162,7 +160,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
status = try_trans2_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a new file name */
param_len = 6;
@@ -175,7 +173,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
&rparam_len, &rdata_len);
cli_unlink(cli, "\\newfile.dat");
cli_rmdir(cli, "\\newfile.dat");
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */
cli_mkdir(cli, "\\testdir");
@@ -186,7 +184,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
cli_rmdir(cli, "\\testdir");
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
return False;
}
@@ -238,25 +236,23 @@ look for a partial hit
****************************************************************************/
static void nttrans_check_hit(char *format, int op, int level, NTSTATUS status)
{
- switch (status) {
- case NT_STATUS_INVALID_LEVEL:
- case NT_STATUS_NOT_IMPLEMENTED:
- case NT_STATUS_NOT_SUPPORTED:
- case NT_STATUS_UNSUCCESSFUL:
- case NT_STATUS_INVALID_INFO_CLASS:
- break;
- default:
+ if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_LEVEL) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_SUPPORTED) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_UNSUCCESSFUL) ||
+ NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
+ return;
+ }
#if VERBOSE
printf("possible %s hit op=%3d level=%5d status=%s\n",
format, op, level, get_nt_error_msg(status));
#endif
- }
}
/****************************************************************************
check for existance of a nttrans call
****************************************************************************/
-static uint32 try_nttrans(struct cli_state *cli,
+static NTSTATUS try_nttrans(struct cli_state *cli,
int op,
char *param, char *data,
int param_len, int data_len,
@@ -284,30 +280,30 @@ static uint32 try_nttrans(struct cli_state *cli,
}
-static uint32 try_nttrans_len(struct cli_state *cli,
+static NTSTATUS try_nttrans_len(struct cli_state *cli,
char *format,
int op, int level,
char *param, char *data,
int param_len, int *data_len,
int *rparam_len, int *rdata_len)
{
- uint32 ret=0;
+ NTSTATUS ret=NT_STATUS_OK;
ret = try_nttrans(cli, op, param, data, param_len,
sizeof(pstring), rparam_len, rdata_len);
#if VERBOSE
printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret));
#endif
- if (ret != 0) return ret;
+ if (!NT_STATUS_IS_OK(ret)) return ret;
*data_len = 0;
while (*data_len < sizeof(pstring)) {
ret = try_nttrans(cli, op, param, data, param_len,
*data_len, rparam_len, rdata_len);
- if (ret == 0) break;
+ if (NT_STATUS_IS_OK(ret)) break;
*data_len += 2;
}
- if (ret == NT_STATUS_OK) {
+ if (NT_STATUS_IS_OK(ret)) {
printf("found %s level=%d data_len=%d rparam_len=%d rdata_len=%d\n",
format, level, *data_len, *rparam_len, *rdata_len);
} else {
@@ -336,7 +332,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
SSVAL(param, 0, level);
status = try_nttrans_len(cli, "void", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a file descriptor */
param_len = 6;
@@ -345,7 +341,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
SSVAL(param, 4, 0);
status = try_nttrans_len(cli, "fnum", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a notify style */
@@ -355,7 +351,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
SSVAL(param, 4, level);
status = try_nttrans_len(cli, "notify", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a file name */
param_len = 6;
@@ -366,7 +362,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
status = try_nttrans_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try with a new file name */
param_len = 6;
@@ -379,7 +375,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
&rparam_len, &rdata_len);
cli_unlink(cli, "\\newfile.dat");
cli_rmdir(cli, "\\newfile.dat");
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */
cli_mkdir(cli, "\\testdir");
@@ -390,7 +386,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len);
cli_rmdir(cli, "\\testdir");
- if (status == 0) return True;
+ if (NT_STATUS_IS_OK(status)) return True;
return False;
}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index e92049d8f3..2e19ec042a 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -169,7 +169,7 @@ BOOL torture_close_connection(struct cli_state *c)
/* check if the server produced the expected error code */
static BOOL check_error(int line, struct cli_state *c,
- uint8 eclass, uint32 ecode, uint32 nterr)
+ uint8 eclass, uint32 ecode, NTSTATUS nterr)
{
if (cli_is_dos_error(c)) {
uint8 class;
@@ -182,8 +182,8 @@ static BOOL check_error(int line, struct cli_state *c,
if (eclass != class || ecode != num) {
printf("unexpected error code class=%d code=%d\n",
(int)class, (int)num);
- printf(" expected %d/%d %d (line=%d)\n",
- (int)eclass, (int)ecode, (int)nterr, line);
+ printf(" expected %d/%d %s (line=%d)\n",
+ (int)eclass, (int)ecode, get_nt_error_msg(nterr), line);
return False;
}
@@ -194,7 +194,7 @@ static BOOL check_error(int line, struct cli_state *c,
status = cli_nt_error(c);
- if (nterr != status) {
+ if (NT_STATUS_V(nterr) != NT_STATUS_V(status)) {
printf("unexpected error code %s\n", get_nt_error_msg(status));
printf(" expected %s (line=%d)\n", get_nt_error_msg(nterr), line);
return False;