summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/async_smb.h5
-rw-r--r--source3/libsmb/async_smb.c11
-rw-r--r--source3/libsmb/cliconnect.c16
-rw-r--r--source3/libsmb/clientgen.c6
-rw-r--r--source3/libsmb/clifile.c36
-rw-r--r--source3/libsmb/climessage.c6
-rw-r--r--source3/libsmb/clioplock.c2
-rw-r--r--source3/libsmb/clireadwrite.c6
-rw-r--r--source3/libsmb/clitrans.c3
9 files changed, 53 insertions, 38 deletions
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index 47fed92739..b73aed0004 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -57,8 +57,9 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
uint8_t wct, uint16_t *vwv,
uint32_t num_bytes,
const uint8_t *bytes);
-NTSTATUS cli_smb_recv(struct tevent_req *req, uint8_t min_wct,
- uint8_t *pwct, uint16_t **pvwv,
+NTSTATUS cli_smb_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx, uint8_t **pinbuf,
+ uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
uint32_t *pnum_bytes, uint8_t **pbytes);
struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 59226e1ecb..9f92ae7012 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -755,8 +755,9 @@ static void cli_smb_received(struct tevent_req *subreq)
}
}
-NTSTATUS cli_smb_recv(struct tevent_req *req, uint8_t min_wct,
- uint8_t *pwct, uint16_t **pvwv,
+NTSTATUS cli_smb_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx, uint8_t **pinbuf,
+ uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
uint32_t *pnum_bytes, uint8_t **pbytes)
{
struct cli_smb_state *state = tevent_req_data(
@@ -868,6 +869,9 @@ no_err:
if (pbytes != NULL) {
*pbytes = (uint8_t *)state->inbuf + bytes_offset + 2;
}
+ if ((mem_ctx != NULL) && (pinbuf != NULL)) {
+ *pinbuf = talloc_move(mem_ctx, &state->inbuf);
+ }
return status;
}
@@ -1055,7 +1059,8 @@ static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq)
uint8_t *bytes;
NTSTATUS status;
- status = cli_smb_recv(subreq, 8, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 8, &wct, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index a81cb06839..f5e763c1f2 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -269,7 +269,8 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
uint8_t *p;
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
@@ -731,7 +732,8 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
uint8_t *p;
uint16_t blob_length;
- status = cli_smb_recv(subreq, 1, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 1, &wct, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)
&& !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
TALLOC_FREE(subreq);
@@ -1527,7 +1529,7 @@ static void cli_ulogoff_done(struct tevent_req *subreq)
req, struct cli_ulogoff_state);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
@@ -1758,7 +1760,8 @@ static void cli_tcon_andx_done(struct tevent_req *subreq)
uint8_t *bytes;
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, &wct, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
@@ -1874,7 +1877,7 @@ static void cli_tdis_done(struct tevent_req *subreq)
req, struct cli_tdis_state);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -2030,7 +2033,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
NTSTATUS status;
uint16_t protnum;
- status = cli_smb_recv(subreq, 1, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 1, &wct, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 0afa9e6be7..92b898146e 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -852,7 +852,8 @@ static void cli_echo_done(struct tevent_req *subreq)
uint32_t num_bytes;
uint8_t *bytes;
- status = cli_smb_recv(subreq, 0, NULL, NULL, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
@@ -989,7 +990,8 @@ NTSTATUS cli_smb(TALLOC_CTX *mem_ctx, struct cli_state *cli,
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
goto fail;
}
- status = cli_smb_recv(req, min_wct, pwct, pvwv, pnum_bytes, pbytes);
+ status = cli_smb_recv(req, NULL, NULL, min_wct, pwct, pvwv,
+ pnum_bytes, pbytes);
fail:
TALLOC_FREE(ev);
if (NT_STATUS_IS_OK(status)) {
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 6c4ae1ad49..80e91a7efd 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1238,7 +1238,7 @@ static void cli_rename_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -1364,7 +1364,7 @@ static void cli_ntrename_internal_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -1559,7 +1559,7 @@ static void cli_unlink_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -1667,7 +1667,7 @@ static void cli_mkdir_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -1775,7 +1775,7 @@ static void cli_rmdir_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -2040,7 +2040,8 @@ static void cli_ntcreate_done(struct tevent_req *subreq)
uint8_t *bytes;
NTSTATUS status;
- status = cli_smb_recv(subreq, 3, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 3, &wct, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
@@ -2252,7 +2253,7 @@ static void cli_open_done(struct tevent_req *subreq)
uint16_t *vwv;
NTSTATUS status;
- status = cli_smb_recv(subreq, 3, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 3, &wct, &vwv, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
@@ -2382,7 +2383,7 @@ static void cli_close_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -2723,7 +2724,7 @@ static void cli_unlock_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -2898,7 +2899,7 @@ static void cli_unlock64_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -3265,7 +3266,7 @@ static void cli_getattrE_done(struct tevent_req *subreq)
uint16_t *vwv = NULL;
NTSTATUS status;
- status = cli_smb_recv(subreq, 11, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 11, &wct, &vwv, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
@@ -3427,7 +3428,7 @@ static void cli_getatr_done(struct tevent_req *subreq)
uint16_t *vwv = NULL;
NTSTATUS status;
- status = cli_smb_recv(subreq, 4, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 4, &wct, &vwv, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
@@ -3561,7 +3562,7 @@ static void cli_setattrE_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -3695,7 +3696,7 @@ static void cli_setatr_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -3806,7 +3807,7 @@ static void cli_chkpath_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -3921,7 +3922,7 @@ static void cli_dskattr_done(struct tevent_req *subreq)
uint16_t *vwv = NULL;
NTSTATUS status;
- status = cli_smb_recv(subreq, 4, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 4, &wct, &vwv, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
@@ -4052,7 +4053,8 @@ static void cli_ctemp_done(struct tevent_req *subreq)
uint32_t num_bytes = 0;
uint8_t *bytes = NULL;
- status = cli_smb_recv(subreq, 1, &wcnt, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 1, &wcnt, &vwv,
+ &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/climessage.c b/source3/libsmb/climessage.c
index 2c8ef58b51..170447b253 100644
--- a/source3/libsmb/climessage.c
+++ b/source3/libsmb/climessage.c
@@ -92,7 +92,7 @@ static void cli_message_start_done(struct tevent_req *subreq)
uint8_t wct;
uint16_t *vwv;
- status = cli_smb_recv(subreq, 0, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, &wct, &vwv, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
@@ -183,7 +183,7 @@ static void cli_message_text_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
@@ -234,7 +234,7 @@ static void cli_message_end_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/clioplock.c b/source3/libsmb/clioplock.c
index 7350c4aaa3..8904ac973f 100644
--- a/source3/libsmb/clioplock.c
+++ b/source3/libsmb/clioplock.c
@@ -66,7 +66,7 @@ static void cli_oplock_ack_done(struct tevent_req *subreq)
subreq, struct tevent_req);
NTSTATUS status;
- status = cli_smb_recv(subreq, 0, NULL, NULL, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 65678740de..47693e3117 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -165,8 +165,8 @@ static void cli_read_andx_done(struct tevent_req *subreq)
uint32_t num_bytes;
uint8_t *bytes;
- state->status = cli_smb_recv(subreq, 12, &wct, &vwv, &num_bytes,
- &bytes);
+ state->status = cli_smb_recv(subreq, NULL, NULL, 12, &wct, &vwv,
+ &num_bytes, &bytes);
if (NT_STATUS_IS_ERR(state->status)) {
tevent_req_nterror(req, state->status);
return;
@@ -1020,7 +1020,7 @@ static void cli_write_andx_done(struct tevent_req *subreq)
uint16_t *vwv;
NTSTATUS status;
- status = cli_smb_recv(subreq, 6, &wct, &vwv, NULL, NULL);
+ status = cli_smb_recv(subreq, NULL, NULL, 6, &wct, &vwv, NULL, NULL);
if (NT_STATUS_IS_ERR(status)) {
TALLOC_FREE(subreq);
tevent_req_nterror(req, status);
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index ec63bc3b9d..48993f01c0 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -1117,7 +1117,8 @@ static void cli_trans_done(struct tevent_req *subreq)
uint8_t *param = NULL;
uint8_t *data = NULL;
- status = cli_smb_recv(subreq, 0, &wct, &vwv, &num_bytes, &bytes);
+ status = cli_smb_recv(subreq, NULL, NULL, 0, &wct, &vwv,
+ &num_bytes, &bytes);
/*
* We can receive something like STATUS_MORE_ENTRIES, so don't use