summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-11-22 00:47:48 +0000
committerRalph Boehme <slow@samba.org>2017-12-06 15:02:16 +0100
commitf29b59239e59c6c9bc3bd8971b3251c6b3b33cba (patch)
treece556fcd00ff20e4b8c1731294d9c576fb83907e /source3
parent9e1f792b2687f7e5514007405ef2987af35349cf (diff)
downloadsamba-f29b59239e59c6c9bc3bd8971b3251c6b3b33cba.tar.gz
s3: libsmb: Rename cli_close_create() -> cli_smb1_close_create().
Move cli_smb1_close_done() next to its caller. This is SMB1 specific. Prepare to wrap cli_close_send/cli_close_recv to handle SMB2. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13159 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clifile.c42
-rw-r--r--source3/libsmb/proto.h2
-rw-r--r--source3/torture/test_chain3.c2
-rw-r--r--source3/torture/torture.c2
4 files changed, 24 insertions, 24 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index e942b27e175..2e3c2426030 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -2770,22 +2770,22 @@ NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags,
Close a file.
****************************************************************************/
-struct cli_close_state {
+struct cli_smb1_close_state {
uint16_t vwv[3];
};
-static void cli_close_done(struct tevent_req *subreq);
+static void cli_smb1_close_done(struct tevent_req *subreq);
-struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
+struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli,
uint16_t fnum,
struct tevent_req **psubreq)
{
struct tevent_req *req, *subreq;
- struct cli_close_state *state;
+ struct cli_smb1_close_state *state;
- req = tevent_req_create(mem_ctx, &state, struct cli_close_state);
+ req = tevent_req_create(mem_ctx, &state, struct cli_smb1_close_state);
if (req == NULL) {
return NULL;
}
@@ -2799,11 +2799,25 @@ struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
TALLOC_FREE(req);
return NULL;
}
- tevent_req_set_callback(subreq, cli_close_done, req);
+ tevent_req_set_callback(subreq, cli_smb1_close_done, req);
*psubreq = subreq;
return req;
}
+static void cli_smb1_close_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ NTSTATUS status;
+
+ status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+ tevent_req_done(req);
+}
+
struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli,
@@ -2812,7 +2826,7 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
struct tevent_req *req, *subreq;
NTSTATUS status;
- req = cli_close_create(mem_ctx, ev, cli, fnum, &subreq);
+ req = cli_smb1_close_create(mem_ctx, ev, cli, fnum, &subreq);
if (req == NULL) {
return NULL;
}
@@ -2824,20 +2838,6 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
return req;
}
-static void cli_close_done(struct tevent_req *subreq)
-{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- NTSTATUS status;
-
- status = cli_smb_recv(subreq, NULL, NULL, 0, NULL, NULL, NULL, NULL);
- TALLOC_FREE(subreq);
- if (tevent_req_nterror(req, status)) {
- return;
- }
- tevent_req_done(req);
-}
-
NTSTATUS cli_close_recv(struct tevent_req *req)
{
return tevent_req_simple_recv_ntstatus(req);
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 4ae566cca1c..d82de56a238 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -423,7 +423,7 @@ struct tevent_req *cli_openx_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev
NTSTATUS cli_openx_recv(struct tevent_req *req, uint16_t *fnum);
NTSTATUS cli_openx(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
-struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
+struct tevent_req *cli_smb1_close_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli, uint16_t fnum,
struct tevent_req **psubreq);
diff --git a/source3/torture/test_chain3.c b/source3/torture/test_chain3.c
index cad1a3fb407..eff39de8702 100644
--- a/source3/torture/test_chain3.c
+++ b/source3/torture/test_chain3.c
@@ -70,7 +70,7 @@ static struct tevent_req *chain3_andx_send(TALLOC_CTX *mem_ctx,
}
tevent_req_set_callback(subreq, chain3_andx_write_done, req);
- subreq = cli_close_create(state, ev, cli, 0, &smbreqs[2]);
+ subreq = cli_smb1_close_create(state, ev, cli, 0, &smbreqs[2]);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index cf8b03ca111..87276c09cb3 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -8066,7 +8066,7 @@ static bool run_chain1(int dummy)
if (reqs[1] == NULL) return false;
tevent_req_set_callback(reqs[1], chain1_write_completion, NULL);
- reqs[2] = cli_close_create(talloc_tos(), evt, cli1, 0, &smbreqs[2]);
+ reqs[2] = cli_smb1_close_create(talloc_tos(), evt, cli1, 0, &smbreqs[2]);
if (reqs[2] == NULL) return false;
tevent_req_set_callback(reqs[2], chain1_close_completion, &done);