diff options
author | Björn Baumbach <bb@sernet.de> | 2011-07-19 11:11:27 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-07-20 22:09:25 +0200 |
commit | 8c360d7f76c7c054781ac41c4d823d0529af1577 (patch) | |
tree | c3c29fb29adc52e72a1f144586fe3fe432b7d1bb | |
parent | 9b168e128a74b7e816a6eea73d1b8db8b915b701 (diff) | |
download | samba-8c360d7f76c7c054781ac41c4d823d0529af1577.tar.gz samba-8c360d7f76c7c054781ac41c4d823d0529af1577.tar.bz2 samba-8c360d7f76c7c054781ac41c4d823d0529af1577.zip |
s3-libsmb: introduce new NTSTATUS cli_read()
Replacement for cli_read_old()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source3/libsmb/clireadwrite.c | 20 | ||||
-rw-r--r-- | source3/libsmb/proto.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index f9c85f6c35..5406007784 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -705,6 +705,26 @@ ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf, return ret; } +NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum, + char *buf, off_t offset, size_t size, + size_t *nread) +{ + NTSTATUS status; + SMB_OFF_T ret; + + status = cli_pull(cli, fnum, offset, size, size, + cli_read_sink, &buf, &ret); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (nread) { + *nread = ret; + } + + return NT_STATUS_OK; +} + /**************************************************************************** write to a file using a SMBwrite and not bypassing 0 byte writes ****************************************************************************/ diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 82c9846603..127983de84 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -740,6 +740,9 @@ NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum, void *priv, SMB_OFF_T *received); ssize_t cli_read_old(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size); +NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum, + char *buf, off_t offset, size_t size, + size_t *nread); NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size1, size_t *ptotal); struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx, |