mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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>
This commit is contained in:
parent
9e1f792b26
commit
f29b59239e
@ -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,32 +2799,12 @@ 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;
|
||||
}
|
||||
|
||||
struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct cli_state *cli,
|
||||
uint16_t fnum)
|
||||
{
|
||||
struct tevent_req *req, *subreq;
|
||||
NTSTATUS status;
|
||||
|
||||
req = cli_close_create(mem_ctx, ev, cli, fnum, &subreq);
|
||||
if (req == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
status = smb1cli_req_chain_submit(&subreq, 1);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
static void cli_close_done(struct tevent_req *subreq)
|
||||
static void cli_smb1_close_done(struct tevent_req *subreq)
|
||||
{
|
||||
struct tevent_req *req = tevent_req_callback_data(
|
||||
subreq, struct tevent_req);
|
||||
@ -2838,6 +2818,26 @@ static void cli_close_done(struct tevent_req *subreq)
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct cli_state *cli,
|
||||
uint16_t fnum)
|
||||
{
|
||||
struct tevent_req *req, *subreq;
|
||||
NTSTATUS status;
|
||||
|
||||
req = cli_smb1_close_create(mem_ctx, ev, cli, fnum, &subreq);
|
||||
if (req == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
status = smb1cli_req_chain_submit(&subreq, 1);
|
||||
if (tevent_req_nterror(req, status)) {
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
return req;
|
||||
}
|
||||
|
||||
NTSTATUS cli_close_recv(struct tevent_req *req)
|
||||
{
|
||||
return tevent_req_simple_recv_ntstatus(req);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user