From 9b168e128a74b7e816a6eea73d1b8db8b915b701 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Baumbach?= Date: Tue, 19 Jul 2011 10:48:16 +0200 Subject: [PATCH] s3-libsmb: replace cli_read() with cli_read_old() Will introduce new cli_read() function. Signed-off-by: Stefan Metzmacher --- source3/client/clitar.c | 2 +- source3/libgpo/gpo_filesync.c | 2 +- source3/libsmb/clireadwrite.c | 2 +- source3/libsmb/libsmb_file.c | 2 +- source3/libsmb/proto.h | 2 +- source3/torture/denytest.c | 4 ++-- source3/torture/nbio.c | 2 +- source3/torture/torture.c | 36 ++++++++++++++++++------------------ source3/torture/utable.c | 2 +- source3/utils/net_rpc_printer.c | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 3fff081ca02..88824617a0f 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -693,7 +693,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname, DEBUG(3,("nread=%.0f\n",(double)nread)); - datalen = cli_read(cli, fnum, data, nread, read_size); + datalen = cli_read_old(cli, fnum, data, nread, read_size); if (datalen == -1) { status = cli_nt_error(cli); diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c index 91e1c2725ac..cdcdcfbf72c 100644 --- a/source3/libgpo/gpo_filesync.c +++ b/source3/libgpo/gpo_filesync.c @@ -67,7 +67,7 @@ NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx, while (1) { - int n = cli_read(cli, fnum, data, nread, read_size); + int n = cli_read_old(cli, fnum, data, nread, read_size); if (n <= 0) break; diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 64bdb484f31..f9c85f6c358 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -691,7 +691,7 @@ static NTSTATUS cli_read_sink(char *buf, size_t n, void *priv) return NT_STATUS_OK; } -ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf, +ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size) { NTSTATUS status; diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index 4517a36f575..ebf49252e89 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -296,7 +296,7 @@ SMBC_read_ctx(SMBCCTX *context, } /*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/ - ret = cli_read(targetcli, file->cli_fd, (char *)buf, offset, count); + ret = cli_read_old(targetcli, file->cli_fd, (char *)buf, offset, count); if (ret < 0) { errno = SMBC_errno(context, targetcli); diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index fe30509bb6e..82c98466038 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -738,7 +738,7 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum, off_t start_offset, SMB_OFF_T size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, void *priv), void *priv, SMB_OFF_T *received); -ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf, +ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size); NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size1, size_t *ptotal); diff --git a/source3/torture/denytest.c b/source3/torture/denytest.c index be01e829dc9..9fea7c5bea9 100644 --- a/source3/torture/denytest.c +++ b/source3/torture/denytest.c @@ -1451,7 +1451,7 @@ bool torture_denytest1(int dummy) } else { char x = 1; res = A_0; - if (cli_read(cli1, fnum2, (char *)&x, 0, 1) == 1) { + if (cli_read_old(cli1, fnum2, (char *)&x, 0, 1) == 1) { res += A_R; } if (NT_STATUS_IS_OK(cli_writeall(cli1, fnum2, 0, @@ -1543,7 +1543,7 @@ bool torture_denytest2(int dummy) } else { char x = 1; res = A_0; - if (cli_read(cli2, fnum2, (char *)&x, 0, 1) == 1) { + if (cli_read_old(cli2, fnum2, (char *)&x, 0, 1) == 1) { res += A_R; } if (NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0, diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 0da6bc084e2..e6caf7476b1 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -215,7 +215,7 @@ void nb_readx(int handle, int offset, int size, int ret_size) int i, ret; i = find_handle(handle); - if ((ret=cli_read(c, ftable[i].fd, buf, offset, size)) != ret_size) { + if ((ret=cli_read_old(c, ftable[i].fd, buf, offset, size)) != ret_size) { printf("(%d) ERROR: read failed on handle %d ofs=%d size=%d res=%d fd %d errno %d (%s)\n", line_count, handle, offset, size, ret, ftable[i].fd, errno, strerror(errno)); exit(1); diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 6e66d9d53fc..42dd7e4e027 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -624,7 +624,7 @@ static bool rw_torture(struct cli_state *c) pid2 = 0; - if (cli_read(c, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) { + if (cli_read_old(c, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) { printf("read failed (%s)\n", cli_errstr(c)); correct = False; } @@ -761,7 +761,7 @@ static bool rw_torture3(struct cli_state *c, char *lockfname) } else { - sent = cli_read(c, fnum, buf_rd+count, count, + sent = cli_read_old(c, fnum, buf_rd+count, count, sizeof(buf)-count); if (sent < 0) { @@ -844,7 +844,7 @@ static bool rw_torture2(struct cli_state *c1, struct cli_state *c2) break; } - if ((bytes_read = cli_read(c2, fnum2, buf_rd, 0, buf_size)) != buf_size) { + if ((bytes_read = cli_read_old(c2, fnum2, buf_rd, 0, buf_size)) != buf_size) { printf("read failed (%s)\n", cli_errstr(c2)); printf("read %d, expected %ld\n", (int)bytes_read, (unsigned long)buf_size); @@ -2004,7 +2004,7 @@ static bool run_locktest4(int dummy) ret = NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 120, 4, 0, WRITE_LOCK)) && - (cli_read(cli2, fnum2, buf, 120, 4) == 4); + (cli_read_old(cli2, fnum2, buf, 120, 4) == 4); EXPECTED(ret, False); printf("this server %s strict write locking\n", ret?"doesn't do":"does"); @@ -2030,7 +2030,7 @@ static bool run_locktest4(int dummy) ret = NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 150, 4, 0, WRITE_LOCK)) && NT_STATUS_IS_OK(cli_lock32(cli1, fnum1, 150, 4, 0, READ_LOCK)) && NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 150, 4)) && - (cli_read(cli2, fnum2, buf, 150, 4) == 4) && + (cli_read_old(cli2, fnum2, buf, 150, 4) == 4) && !(NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0, (uint8_t *)buf, 150, 4, NULL))) && NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 150, 4)); @@ -2041,7 +2041,7 @@ static bool run_locktest4(int dummy) NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 160, 4)) && NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0, (uint8_t *)buf, 160, 4, NULL)) && - (cli_read(cli2, fnum2, buf, 160, 4) == 4); + (cli_read_old(cli2, fnum2, buf, 160, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove a read lock using write locking\n", ret?"can":"cannot"); @@ -2049,7 +2049,7 @@ static bool run_locktest4(int dummy) NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 170, 4)) && NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0, (uint8_t *)buf, 170, 4, NULL)) && - (cli_read(cli2, fnum2, buf, 170, 4) == 4); + (cli_read_old(cli2, fnum2, buf, 170, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove a write lock using read locking\n", ret?"can":"cannot"); @@ -2058,7 +2058,7 @@ static bool run_locktest4(int dummy) NT_STATUS_IS_OK(cli_unlock(cli1, fnum1, 190, 4)) && !NT_STATUS_IS_OK(cli_writeall(cli2, fnum2, 0, (uint8_t *)buf, 190, 4, NULL)) && - (cli_read(cli2, fnum2, buf, 190, 4) == 4); + (cli_read_old(cli2, fnum2, buf, 190, 4) == 4); EXPECTED(ret, True); printf("the same process %s remove the first lock first\n", ret?"does":"doesn't"); @@ -2301,7 +2301,7 @@ static bool run_locktest7(int dummy) printf("pid1 successfully locked range 130:4 for READ\n"); } - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { + 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)); goto fail; } else { @@ -2323,7 +2323,7 @@ static bool run_locktest7(int dummy) cli_setpid(cli1, 2); - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { + 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)); } else { printf("pid2 successfully read the range 130:4\n"); @@ -2353,7 +2353,7 @@ static bool run_locktest7(int dummy) printf("pid1 successfully locked range 130:4 for WRITE\n"); } - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { + 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)); goto fail; } else { @@ -2371,7 +2371,7 @@ static bool run_locktest7(int dummy) cli_setpid(cli1, 2); - if (cli_read(cli1, fnum1, buf, 130, 4) != 4) { + 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)) { printf("Incorrect error (should be NT_STATUS_FILE_LOCK_CONFLICT)\n"); @@ -2727,7 +2727,7 @@ static bool run_fdpasstest(int dummy) cli_state_set_tid(cli2, cli_state_get_tid(cli1)); cli_setpid(cli2, cli_getpid(cli1)); - if (cli_read(cli2, fnum1, buf, 0, 13) == 13) { + if (cli_read_old(cli2, fnum1, buf, 0, 13) == 13) { printf("read succeeded! nasty security hole [%s]\n", buf); return False; @@ -2792,7 +2792,7 @@ static bool run_fdsesstest(int dummy) saved_vuid = cli->vuid; cli->vuid = new_vuid; - if (cli_read(cli, fnum1, buf, 0, 13) == 13) { + if (cli_read_old(cli, fnum1, buf, 0, 13) == 13) { printf("read succeeded with different vuid! nasty security hole [%s]\n", buf); ret = False; @@ -2813,7 +2813,7 @@ static bool run_fdsesstest(int dummy) /* Try with same vuid, different cnum. */ cli_state_set_tid(cli, new_cnum); - if (cli_read(cli, fnum1, buf, 0, 13) == 13) { + if (cli_read_old(cli, fnum1, buf, 0, 13) == 13) { printf("read succeeded with different cnum![%s]\n", buf); ret = False; @@ -3539,7 +3539,7 @@ static bool run_oplock2(int dummy) /* Ensure cli1 processes the break. Empty file should always return 0 * bytes. */ - if (cli_read(cli1, fnum1, buf, 0, 4) != 0) { + if (cli_read_old(cli1, fnum1, buf, 0, 4) != 0) { printf("read on fnum1 failed (%s)\n", cli_errstr(cli1)); correct = False; } @@ -3566,7 +3566,7 @@ static bool run_oplock2(int dummy) sleep(2); - cli_read(cli1, fnum1, buf, 0, 4); + cli_read_old(cli1, fnum1, buf, 0, 4); status = cli_close(cli1, fnum1); if (!NT_STATUS_IS_OK(status)) { @@ -5484,7 +5484,7 @@ static bool run_simple_posix_open_test(int dummy) goto out; } - if (cli_read(cli1, fnum1, buf, 0, 10) != 10) { + if (cli_read_old(cli1, fnum1, buf, 0, 10) != 10) { printf("POSIX read of %s failed (%s)\n", hname, cli_errstr(cli1)); goto out; } diff --git a/source3/torture/utable.c b/source3/torture/utable.c index 4c6605d9210..b75790e17bf 100644 --- a/source3/torture/utable.c +++ b/source3/torture/utable.c @@ -188,7 +188,7 @@ bool torture_casetable(int dummy) return False; } - cli_read(cli, fnum, (char *)c2, 0, size); + cli_read_old(cli, fnum, (char *)c2, 0, size); printf("%04x: ", c); equiv[c][0] = c; for (i=0; i