summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-08-13 04:08:42 +0000
committerTim Potter <tpot@samba.org>2001-08-13 04:08:42 +0000
commite7630562c98c1bc9f3796365df9be58c9bd9c382 (patch)
treec76386ffa4adc24fc74d05052bc2c7a02f06a230 /source3/torture
parentce5233ffb34fbdf3182100f8881e111a9486a89d (diff)
downloadsamba-e7630562c98c1bc9f3796365df9be58c9bd9c382.tar.gz
samba-e7630562c98c1bc9f3796365df9be58c9bd9c382.tar.bz2
samba-e7630562c98c1bc9f3796365df9be58c9bd9c382.zip
Converted to new error API.
Now that we support NT errors from the client, appropriate values will need to be filled in for the various invocations of check_error() within the torture code. (This used to be commit 577f6065f6c6b0cfbd7f8cfd11d28a0962a6d221)
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index c1eb4371f6..c67d50bb5c 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -171,17 +171,36 @@ static BOOL close_connection(struct cli_state *c)
static BOOL check_error(struct cli_state *c,
uint8 eclass, uint32 ecode, uint32 nterr)
{
- uint8 class;
- uint32 num;
- (void)cli_error(c, &class, &num, NULL);
- if ((eclass != class || ecode != num) &&
- num != (nterr&0xFFFFFF)) {
- printf("unexpected error code class=%d code=%d\n",
- (int)class, (int)num);
- printf(" expected %d/%d %d\n",
- (int)eclass, (int)ecode, (int)nterr);
- return False;
- }
+ if (cli_is_dos_error(c)) {
+ uint8 class;
+ uint32 num;
+
+ /* Check DOS error */
+
+ cli_dos_error(c, &class, &num);
+
+ if (eclass != class || ecode != num) {
+ printf("unexpected error code class=%d code=%d\n",
+ (int)class, (int)num);
+ printf(" expected %d/%d %d\n",
+ (int)eclass, (int)ecode, (int)nterr);
+ return False;
+ }
+
+ } else {
+ uint32 status;
+
+ /* Check NT error */
+
+ status = cli_nt_error(c);
+
+ if (nterr != status) {
+ printf("unexpected error code 0x%08x\n", status);
+ printf(" expected 0x%08x\n", nterr);
+ return False;
+ }
+ }
+
return True;
}
@@ -2785,8 +2804,6 @@ static BOOL run_opentest(int dummy)
static struct cli_state cli1;
char *fname = "\\readonly.file";
int fnum1, fnum2;
- uint8 eclass;
- uint32 errnum;
char buf[20];
size_t fsize;
BOOL correct = True;
@@ -2827,17 +2844,10 @@ static BOOL run_opentest(int dummy)
/* This will fail - but the error should be ERRnoaccess, not ERRbadshare. */
fnum2 = cli_open(&cli1, fname, O_RDWR, DENY_ALL);
- cli_error( &cli1, &eclass, &errnum, NULL);
-
- if (eclass != ERRDOS || errnum != ERRnoaccess) {
- printf("wrong error code (%x,%x) = %s\n", (unsigned int)eclass,
- (unsigned int)errnum, cli_errstr(&cli1) );
- correct = False;
- } else {
+ if (check_error(&cli1, ERRDOS, ERRnoaccess, 0)) {
printf("correct error code ERRDOS/ERRnoaccess returned\n");
}
-
printf("finished open test 1\n");
cli_close(&cli1, fnum1);
@@ -2855,13 +2865,7 @@ static BOOL run_opentest(int dummy)
/* This will fail - but the error should be ERRshare. */
fnum2 = cli_open(&cli1, fname, O_RDWR, DENY_ALL);
- cli_error( &cli1, &eclass, &errnum, NULL);
-
- if (eclass != ERRDOS || errnum != ERRbadshare) {
- printf("wrong error code (%x,%x) = %s\n", (unsigned int)eclass,
- (unsigned int)errnum, cli_errstr(&cli1) );
- correct = False;
- } else {
+ if (check_error(&cli1, ERRDOS, ERRbadshare, 0)) {
printf("correct error code ERRDOS/ERRbadshare returned\n");
}