summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-23 09:16:27 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-23 09:18:20 +0200
commitcfec548aa0cdd726911efb7fd5c501e464dfc3e0 (patch)
tree40f4bb154a12aa7e46aa165274354fbb81ac088f /source3/torture
parent4971a0a2bc5cc75d0142829d0fc16f1f2a06af17 (diff)
downloadsamba-cfec548aa0cdd726911efb7fd5c501e464dfc3e0.tar.gz
samba-cfec548aa0cdd726911efb7fd5c501e464dfc3e0.tar.bz2
samba-cfec548aa0cdd726911efb7fd5c501e464dfc3e0.zip
s3-torture: run_locktest7(): replace cli_read_old() with cli_read()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c45
1 files changed, 34 insertions, 11 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index f9d4628e8b..2b78014d65 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -2301,6 +2301,7 @@ static bool run_locktest7(int dummy)
uint16_t fnum1;
char buf[200];
bool correct = False;
+ size_t nread;
NTSTATUS status;
if (!torture_open_connection(&cli1, 0)) {
@@ -2328,14 +2329,21 @@ static bool run_locktest7(int dummy)
status = cli_lock32(cli1, fnum1, 130, 4, 0, READ_LOCK);
if (!NT_STATUS_IS_OK(status)) {
- printf("Unable to apply read lock on range 130:4, error was %s\n", nt_errstr(status));
+ printf("Unable to apply read lock on range 130:4, "
+ "error was %s\n", nt_errstr(status));
goto fail;
} else {
printf("pid1 successfully locked range 130:4 for READ\n");
}
- if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
- printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+ status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pid1 unable to read the range 130:4, error was %s\n",
+ nt_errstr(status));
+ goto fail;
+ } else if (nread != 4) {
+ printf("pid1 unable to read the range 130:4, "
+ "recv %ld req %d\n", (unsigned long)nread, 4);
goto fail;
} else {
printf("pid1 successfully read the range 130:4\n");
@@ -2356,8 +2364,14 @@ static bool run_locktest7(int dummy)
cli_setpid(cli1, 2);
- if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
- printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+ status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pid2 unable to read the range 130:4, error was %s\n",
+ nt_errstr(status));
+ goto fail;
+ } else if (nread != 4) {
+ printf("pid2 unable to read the range 130:4, "
+ "recv %ld req %d\n", (unsigned long)nread, 4);
goto fail;
} else {
printf("pid2 successfully read the range 130:4\n");
@@ -2387,8 +2401,14 @@ static bool run_locktest7(int dummy)
printf("pid1 successfully locked range 130:4 for WRITE\n");
}
- if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
- printf("pid1 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
+ status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pid1 unable to read the range 130:4, error was %s\n",
+ nt_errstr(status));
+ goto fail;
+ } else if (nread != 4) {
+ printf("pid1 unable to read the range 130:4, "
+ "recv %ld req %d\n", (unsigned long)nread, 4);
goto fail;
} else {
printf("pid1 successfully read the range 130:4\n");
@@ -2405,14 +2425,17 @@ static bool run_locktest7(int dummy)
cli_setpid(cli1, 2);
- if (cli_read_old(cli1, fnum1, buf, 130, 4) != 4) {
- printf("pid2 unable to read the range 130:4, error was %s\n", cli_errstr(cli1));
- if (NT_STATUS_V(cli_nt_error(cli1)) != NT_STATUS_V(NT_STATUS_FILE_LOCK_CONFLICT)) {
+ status = cli_read(cli1, fnum1, buf, 130, 4, &nread);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("pid2 unable to read the range 130:4, error was "
+ "%s\n", nt_errstr(status));
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) {
printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n");
goto fail;
}
} else {
- printf("pid2 successfully read the range 130:4 (should be denied)\n");
+ printf("pid2 successfully read the range 130:4 (should be denied) recv %ld\n",
+ (unsigned long)nread);
goto fail;
}