summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-05-12 14:47:02 +0200
committerStefan Metzmacher <metze@samba.org>2009-05-13 18:27:50 +0200
commitca6ec5ecd78d98ef841981b2ea124b1d772e4ceb (patch)
tree33ec99b68759cd3c2353f5e559cdefa39fceb870 /source3
parent6ff09b323e1bb3b82a27f6015ba94ccce36993af (diff)
downloadsamba-ca6ec5ecd78d98ef841981b2ea124b1d772e4ceb.tar.gz
samba-ca6ec5ecd78d98ef841981b2ea124b1d772e4ceb.tar.bz2
samba-ca6ec5ecd78d98ef841981b2ea124b1d772e4ceb.zip
s3:libsmb: let cli_smb_chain_send() also return NTSTATUS
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/include/async_smb.h2
-rw-r--r--source3/libsmb/async_smb.c21
-rw-r--r--source3/torture/torture.c8
3 files changed, 19 insertions, 12 deletions
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index c27dd2b36f..03dd274539 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -49,7 +49,7 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
struct iovec *bytes_iov);
NTSTATUS cli_smb_req_send(struct tevent_req *req);
size_t cli_smb_wct_ofs(struct tevent_req **reqs, int num_reqs);
-bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs);
+NTSTATUS cli_smb_chain_send(struct tevent_req **reqs, int num_reqs);
uint8_t *cli_smb_inbuf(struct tevent_req *req);
bool cli_has_async_calls(struct cli_state *cli);
void cli_smb_req_unset_pending(struct tevent_req *req);
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 77ef87785f..7474959902 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -951,7 +951,7 @@ size_t cli_smb_wct_ofs(struct tevent_req **reqs, int num_reqs)
return wct_ofs;
}
-bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
+NTSTATUS cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
{
struct cli_smb_state *first_state = tevent_req_data(
reqs[0], struct cli_smb_state);
@@ -973,13 +973,14 @@ bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
iov = talloc_array(last_state, struct iovec, iovlen);
if (iov == NULL) {
- goto fail;
+ return NT_STATUS_NO_MEMORY;
}
first_state->chained_requests = (struct tevent_req **)talloc_memdup(
last_state, reqs, sizeof(*reqs) * num_reqs);
if (first_state->chained_requests == NULL) {
- goto fail;
+ TALLOC_FREE(iov);
+ return NT_STATUS_NO_MEMORY;
}
wct_offset = smb_wct - 4;
@@ -994,7 +995,9 @@ bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
if (i < num_reqs-1) {
if (!is_andx_req(CVAL(state->header, smb_com))
|| CVAL(state->header, smb_wct) < 2) {
- goto fail;
+ TALLOC_FREE(iov);
+ TALLOC_FREE(first_state->chained_requests);
+ return NT_STATUS_INVALID_PARAMETER;
}
}
@@ -1042,12 +1045,12 @@ bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
status = cli_smb_req_iov_send(reqs[0], last_state, iov, iovlen);
if (!NT_STATUS_IS_OK(status)) {
- goto fail;
+ TALLOC_FREE(iov);
+ TALLOC_FREE(first_state->chained_requests);
+ return status;
}
- return true;
- fail:
- TALLOC_FREE(iov);
- return false;
+
+ return NT_STATUS_OK;
}
uint8_t *cli_smb_inbuf(struct tevent_req *req)
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 53a39c6999..578f6a345f 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4959,6 +4959,7 @@ static bool run_chain1(int dummy)
struct tevent_req *reqs[3], *smbreqs[3];
bool done = false;
const char *str = "foobar";
+ NTSTATUS status;
printf("starting chain1 test\n");
if (!torture_open_connection(&cli1, 0)) {
@@ -4983,7 +4984,8 @@ static bool run_chain1(int dummy)
if (reqs[2] == NULL) return false;
tevent_req_set_callback(reqs[2], chain1_close_completion, &done);
- if (!cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs))) {
+ status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}
@@ -5017,6 +5019,7 @@ static bool run_chain2(int dummy)
struct event_context *evt = event_context_init(NULL);
struct tevent_req *reqs[2], *smbreqs[2];
bool done = false;
+ NTSTATUS status;
printf("starting chain2 test\n");
if (!torture_open_connection(&cli1, 0)) {
@@ -5035,7 +5038,8 @@ static bool run_chain2(int dummy)
if (reqs[1] == NULL) return false;
tevent_req_set_callback(reqs[1], chain2_tcon_completion, &done);
- if (!cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs))) {
+ status = cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs));
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}