1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

fixed compilation of torture

(This used to be commit aaf538a830)
This commit is contained in:
Andrew Tridgell 2001-09-04 11:52:42 +00:00
parent ed3fbafdd3
commit cefa698c72
2 changed files with 45 additions and 49 deletions

View File

@ -32,25 +32,23 @@ look for a partial hit
****************************************************************************/ ****************************************************************************/
static void trans2_check_hit(char *format, int op, int level, NTSTATUS status) static void trans2_check_hit(char *format, int op, int level, NTSTATUS status)
{ {
switch (status) { if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_LEVEL) ||
case NT_STATUS_INVALID_LEVEL: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ||
case NT_STATUS_NOT_IMPLEMENTED: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_SUPPORTED) ||
case NT_STATUS_NOT_SUPPORTED: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_UNSUCCESSFUL) ||
case NT_STATUS_UNSUCCESSFUL: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
case NT_STATUS_INVALID_INFO_CLASS: return;
break;
default:
#if VERBOSE
printf("possible %s hit op=%3d level=%5d status=%s\n",
format, op, level, get_nt_error_msg(status));
#endif
} }
#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 trans2 call 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, int op,
char *param, char *data, char *param, char *data,
int param_len, int data_len, 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, char *format,
int op, int level, int op, int level,
char *param, char *data, char *param, char *data,
int param_len, int *data_len, int param_len, int *data_len,
int *rparam_len, int *rdata_len) int *rparam_len, int *rdata_len)
{ {
uint32 ret=0; NTSTATUS ret=NT_STATUS_OK;
ret = try_trans2(cli, op, param, data, param_len, ret = try_trans2(cli, op, param, data, param_len,
sizeof(pstring), rparam_len, rdata_len); sizeof(pstring), rparam_len, rdata_len);
#if VERBOSE #if VERBOSE
printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret)); printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret));
#endif #endif
if (ret != 0) return ret; if (!NT_STATUS_IS_OK(ret)) return ret;
*data_len = 0; *data_len = 0;
while (*data_len < sizeof(pstring)) { while (*data_len < sizeof(pstring)) {
ret = try_trans2(cli, op, param, data, param_len, ret = try_trans2(cli, op, param, data, param_len,
*data_len, rparam_len, rdata_len); *data_len, rparam_len, rdata_len);
if (ret == 0) break; if (NT_STATUS_IS_OK(ret)) break;
*data_len += 2; *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", printf("found %s level=%d data_len=%d rparam_len=%d rdata_len=%d\n",
format, level, *data_len, *rparam_len, *rdata_len); format, level, *data_len, *rparam_len, *rdata_len);
} else { } else {
@ -132,7 +130,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
SSVAL(param, 0, level); SSVAL(param, 0, level);
status = try_trans2_len(cli, "void", op, level, param, data, param_len, &data_len, status = try_trans2_len(cli, "void", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a file descriptor */ /* try with a file descriptor */
param_len = 6; param_len = 6;
@ -141,7 +139,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
SSVAL(param, 4, 0); SSVAL(param, 4, 0);
status = try_trans2_len(cli, "fnum", op, level, param, data, param_len, &data_len, status = try_trans2_len(cli, "fnum", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a notify style */ /* 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); SSVAL(param, 4, level);
status = try_trans2_len(cli, "notify", op, level, param, data, param_len, &data_len, status = try_trans2_len(cli, "notify", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a file name */ /* try with a file name */
param_len = 6; 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, status = try_trans2_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a new file name */ /* try with a new file name */
param_len = 6; param_len = 6;
@ -175,7 +173,7 @@ static BOOL scan_trans2(struct cli_state *cli, int op, int level,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
cli_unlink(cli, "\\newfile.dat"); cli_unlink(cli, "\\newfile.dat");
cli_rmdir(cli, "\\newfile.dat"); cli_rmdir(cli, "\\newfile.dat");
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */ /* try dfs style */
cli_mkdir(cli, "\\testdir"); 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, status = try_trans2_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
cli_rmdir(cli, "\\testdir"); cli_rmdir(cli, "\\testdir");
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
return False; return False;
} }
@ -238,25 +236,23 @@ look for a partial hit
****************************************************************************/ ****************************************************************************/
static void nttrans_check_hit(char *format, int op, int level, NTSTATUS status) static void nttrans_check_hit(char *format, int op, int level, NTSTATUS status)
{ {
switch (status) { if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_LEVEL) ||
case NT_STATUS_INVALID_LEVEL: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ||
case NT_STATUS_NOT_IMPLEMENTED: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_NOT_SUPPORTED) ||
case NT_STATUS_NOT_SUPPORTED: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_UNSUCCESSFUL) ||
case NT_STATUS_UNSUCCESSFUL: NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
case NT_STATUS_INVALID_INFO_CLASS: return;
break; }
default:
#if VERBOSE #if VERBOSE
printf("possible %s hit op=%3d level=%5d status=%s\n", printf("possible %s hit op=%3d level=%5d status=%s\n",
format, op, level, get_nt_error_msg(status)); format, op, level, get_nt_error_msg(status));
#endif #endif
}
} }
/**************************************************************************** /****************************************************************************
check for existance of a nttrans call 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, int op,
char *param, char *data, char *param, char *data,
int param_len, int data_len, 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, char *format,
int op, int level, int op, int level,
char *param, char *data, char *param, char *data,
int param_len, int *data_len, int param_len, int *data_len,
int *rparam_len, int *rdata_len) int *rparam_len, int *rdata_len)
{ {
uint32 ret=0; NTSTATUS ret=NT_STATUS_OK;
ret = try_nttrans(cli, op, param, data, param_len, ret = try_nttrans(cli, op, param, data, param_len,
sizeof(pstring), rparam_len, rdata_len); sizeof(pstring), rparam_len, rdata_len);
#if VERBOSE #if VERBOSE
printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret)); printf("op=%d level=%d ret=%s\n", op, level, get_nt_error_msg(ret));
#endif #endif
if (ret != 0) return ret; if (!NT_STATUS_IS_OK(ret)) return ret;
*data_len = 0; *data_len = 0;
while (*data_len < sizeof(pstring)) { while (*data_len < sizeof(pstring)) {
ret = try_nttrans(cli, op, param, data, param_len, ret = try_nttrans(cli, op, param, data, param_len,
*data_len, rparam_len, rdata_len); *data_len, rparam_len, rdata_len);
if (ret == 0) break; if (NT_STATUS_IS_OK(ret)) break;
*data_len += 2; *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", printf("found %s level=%d data_len=%d rparam_len=%d rdata_len=%d\n",
format, level, *data_len, *rparam_len, *rdata_len); format, level, *data_len, *rparam_len, *rdata_len);
} else { } else {
@ -336,7 +332,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
SSVAL(param, 0, level); SSVAL(param, 0, level);
status = try_nttrans_len(cli, "void", op, level, param, data, param_len, &data_len, status = try_nttrans_len(cli, "void", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a file descriptor */ /* try with a file descriptor */
param_len = 6; param_len = 6;
@ -345,7 +341,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
SSVAL(param, 4, 0); SSVAL(param, 4, 0);
status = try_nttrans_len(cli, "fnum", op, level, param, data, param_len, &data_len, status = try_nttrans_len(cli, "fnum", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a notify style */ /* 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); SSVAL(param, 4, level);
status = try_nttrans_len(cli, "notify", op, level, param, data, param_len, &data_len, status = try_nttrans_len(cli, "notify", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a file name */ /* try with a file name */
param_len = 6; 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, status = try_nttrans_len(cli, "fname", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try with a new file name */ /* try with a new file name */
param_len = 6; param_len = 6;
@ -379,7 +375,7 @@ static BOOL scan_nttrans(struct cli_state *cli, int op, int level,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
cli_unlink(cli, "\\newfile.dat"); cli_unlink(cli, "\\newfile.dat");
cli_rmdir(cli, "\\newfile.dat"); cli_rmdir(cli, "\\newfile.dat");
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
/* try dfs style */ /* try dfs style */
cli_mkdir(cli, "\\testdir"); 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, status = try_nttrans_len(cli, "dfs", op, level, param, data, param_len, &data_len,
&rparam_len, &rdata_len); &rparam_len, &rdata_len);
cli_rmdir(cli, "\\testdir"); cli_rmdir(cli, "\\testdir");
if (status == 0) return True; if (NT_STATUS_IS_OK(status)) return True;
return False; return False;
} }

View File

@ -169,7 +169,7 @@ BOOL torture_close_connection(struct cli_state *c)
/* check if the server produced the expected error code */ /* 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, struct cli_state *c,
uint8 eclass, uint32 ecode, uint32 nterr) uint8 eclass, uint32 ecode, NTSTATUS nterr)
{ {
if (cli_is_dos_error(c)) { if (cli_is_dos_error(c)) {
uint8 class; uint8 class;
@ -182,8 +182,8 @@ static BOOL check_error(int line, struct cli_state *c,
if (eclass != class || ecode != num) { if (eclass != class || ecode != num) {
printf("unexpected error code class=%d code=%d\n", printf("unexpected error code class=%d code=%d\n",
(int)class, (int)num); (int)class, (int)num);
printf(" expected %d/%d %d (line=%d)\n", printf(" expected %d/%d %s (line=%d)\n",
(int)eclass, (int)ecode, (int)nterr, line); (int)eclass, (int)ecode, get_nt_error_msg(nterr), line);
return False; return False;
} }
@ -194,7 +194,7 @@ static BOOL check_error(int line, struct cli_state *c,
status = cli_nt_error(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("unexpected error code %s\n", get_nt_error_msg(status));
printf(" expected %s (line=%d)\n", get_nt_error_msg(nterr), line); printf(" expected %s (line=%d)\n", get_nt_error_msg(nterr), line);
return False; return False;