1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:libsmb: add support for SMB2 to cli_nt_delete_on_close*()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2017-06-20 08:35:47 +02:00
parent 8d4005b07b
commit 38f1aeba7e

View File

@ -1803,12 +1803,8 @@ struct doc_state {
uint8_t data[1];
};
static void cli_nt_delete_on_close_done(struct tevent_req *subreq)
{
NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, NULL, 0, NULL,
NULL, 0, NULL, NULL, 0, NULL);
tevent_req_simple_finish_ntstatus(subreq, status);
}
static void cli_nt_delete_on_close_smb1_done(struct tevent_req *subreq);
static void cli_nt_delete_on_close_smb2_done(struct tevent_req *subreq);
struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
@ -1824,6 +1820,18 @@ struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
return NULL;
}
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
subreq = cli_smb2_delete_on_close_send(state, ev, cli,
fnum, flag);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq,
cli_nt_delete_on_close_smb2_done,
req);
return req;
}
/* Setup setup word. */
SSVAL(&state->setup, 0, TRANSACT2_SETFILEINFO);
@ -1856,10 +1864,25 @@ struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
tevent_req_set_callback(subreq, cli_nt_delete_on_close_done, req);
tevent_req_set_callback(subreq,
cli_nt_delete_on_close_smb1_done,
req);
return req;
}
static void cli_nt_delete_on_close_smb1_done(struct tevent_req *subreq)
{
NTSTATUS status = cli_trans_recv(subreq, NULL, NULL, NULL, 0, NULL,
NULL, 0, NULL, NULL, 0, NULL);
tevent_req_simple_finish_ntstatus(subreq, status);
}
static void cli_nt_delete_on_close_smb2_done(struct tevent_req *subreq)
{
NTSTATUS status = cli_smb2_delete_on_close_recv(subreq);
tevent_req_simple_finish_ntstatus(subreq, status);
}
NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req)
{
return tevent_req_simple_recv_ntstatus(req);