From: Volker Lendecke Date: Fri, 13 Nov 2020 15:29:23 +0000 (+0100) Subject: libsmb: Make cli_rename_send()/recv() smb2-capable X-Git-Tag: samba-4.14.0rc1~601 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fdcfdcffb91d4f5c89abe0e71abb84c31cb106a;p=thirdparty%2Fsamba.git libsmb: Make cli_rename_send()/recv() smb2-capable Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index ee0b80ee378..c619b009ec4 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1383,6 +1383,7 @@ struct cli_rename_state { static void cli_rename_done1(struct tevent_req *subreq); static void cli_rename_done_cifs(struct tevent_req *subreq); +static void cli_rename_done2(struct tevent_req *subreq); struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -1399,6 +1400,16 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx, return NULL; } + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + subreq = cli_smb2_rename_send( + state, ev, cli, fname_src, fname_dst, replace); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, cli_rename_done2, req); + return req; + } + if (replace && smbXcli_conn_support_passthrough(cli->conn)) { subreq = cli_smb1_rename_send( state, ev, cli, fname_src, fname_dst, replace); @@ -1430,6 +1441,12 @@ static void cli_rename_done_cifs(struct tevent_req *subreq) tevent_req_simple_finish_ntstatus(subreq, status); } +static void cli_rename_done2(struct tevent_req *subreq) +{ + NTSTATUS status = cli_smb2_rename_recv(subreq); + tevent_req_simple_finish_ntstatus(subreq, status); +} + NTSTATUS cli_rename_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); @@ -1445,10 +1462,6 @@ NTSTATUS cli_rename(struct cli_state *cli, struct tevent_req *req; NTSTATUS status = NT_STATUS_OK; - if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { - return cli_smb2_rename(cli, fname_src, fname_dst, replace); - } - frame = talloc_stackframe(); if (smbXcli_conn_has_async_calls(cli->conn)) {