libsmb: Add "flags" to cli_smb2_close_fnum_send()
authorVolker Lendecke <vl@samba.org>
Sat, 7 Oct 2023 10:06:26 +0000 (12:06 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 10 Oct 2023 08:19:29 +0000 (08:19 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15487

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
examples/fuse/clifuse.c
source3/libsmb/cli_smb2_fnum.c
source3/libsmb/cli_smb2_fnum.h
source3/libsmb/clifile.c

index 28c5177b2500ac38ec83593d5157fc19ad7ec0ec..ba4aca751feb6a9e01ff187a125caf78d12b2475 100644 (file)
@@ -952,7 +952,7 @@ static void cli_ll_release(fuse_req_t freq, fuse_ino_t ino,
 
        fnum = fi->fh;
 
-       req = cli_smb2_close_fnum_send(state, mstate->ev, mstate->cli, fnum);
+       req = cli_smb2_close_fnum_send(state, mstate->ev, mstate->cli, fnum, 0);
        if (req == NULL) {
                TALLOC_FREE(state);
                fuse_reply_err(freq, ENOMEM);
index 42f6d807fc5f3c795086d6fa75cac569ad037966..1939db1b71151671a26c69fc781bcf4413985690 100644 (file)
@@ -463,7 +463,8 @@ static void cli_smb2_close_fnum_done(struct tevent_req *subreq);
 struct tevent_req *cli_smb2_close_fnum_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
                                            struct cli_state *cli,
-                                           uint16_t fnum)
+                                           uint16_t fnum,
+                                           uint16_t flags)
 {
        struct tevent_req *req, *subreq;
        struct cli_smb2_close_fnum_state *state;
@@ -482,9 +483,14 @@ struct tevent_req *cli_smb2_close_fnum_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       subreq = smb2cli_close_send(state, ev, cli->conn, cli->timeout,
-                                   cli->smb2.session, cli->smb2.tcon,
-                                   0, state->ph->fid_persistent,
+       subreq = smb2cli_close_send(state,
+                                   ev,
+                                   cli->conn,
+                                   cli->timeout,
+                                   cli->smb2.session,
+                                   cli->smb2.tcon,
+                                   flags,
+                                   state->ph->fid_persistent,
                                    state->ph->fid_volatile);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -546,7 +552,7 @@ NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum)
        if (ev == NULL) {
                goto fail;
        }
-       req = cli_smb2_close_fnum_send(frame, ev, cli, fnum);
+       req = cli_smb2_close_fnum_send(frame, ev, cli, fnum, 0);
        if (req == NULL) {
                goto fail;
        }
@@ -843,7 +849,8 @@ static void cli_smb2_mkdir_opened(struct tevent_req *subreq)
                return;
        }
 
-       subreq = cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum);
+       subreq =
+               cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum, 0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -1004,8 +1011,11 @@ static void cli_smb2_rmdir_disp_set(struct tevent_req *subreq)
         * Close the fd even if the set_disp failed
         */
 
-       subreq = cli_smb2_close_fnum_send(
-               state, state->ev, state->cli, state->fnum);
+       subreq = cli_smb2_close_fnum_send(state,
+                                         state->ev,
+                                         state->cli,
+                                         state->fnum,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -1134,7 +1144,8 @@ static void cli_smb2_unlink_opened1(struct tevent_req *subreq)
                return;
        }
 
-       subreq = cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum);
+       subreq =
+               cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum, 0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -1157,7 +1168,8 @@ static void cli_smb2_unlink_opened2(struct tevent_req *subreq)
                return;
        }
 
-       subreq = cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum);
+       subreq =
+               cli_smb2_close_fnum_send(state, state->ev, state->cli, fnum, 0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -1541,8 +1553,11 @@ static void cli_smb2_list_done(struct tevent_req *subreq)
 
        TALLOC_FREE(response);
 
-       subreq = cli_smb2_close_fnum_send(
-               state, state->ev, state->cli, state->fnum);
+       subreq = cli_smb2_close_fnum_send(state,
+                                         state->ev,
+                                         state->cli,
+                                         state->fnum,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -2345,7 +2360,8 @@ static void cli_smb2_qpathinfo_done(struct tevent_req *subreq)
        subreq = cli_smb2_close_fnum_send(state,
                                          state->ev,
                                          state->cli,
-                                         state->fnum);
+                                         state->fnum,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -3027,8 +3043,11 @@ static void cli_smb2_mxac_opened(struct tevent_req *subreq)
        state->mxac = IVAL(mxac_blob->data.data, 4);
 
 close:
-       subreq = cli_smb2_close_fnum_send(
-               state, state->ev, state->cli, state->fnum);
+       subreq = cli_smb2_close_fnum_send(state,
+                                         state->ev,
+                                         state->cli,
+                                         state->fnum,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -3333,8 +3352,11 @@ static void cli_smb2_rename_renamed(struct tevent_req *subreq)
        state->rename_status = cli_smb2_rename_fnum_recv(subreq);
        TALLOC_FREE(subreq);
 
-       subreq = cli_smb2_close_fnum_send(
-               state, state->ev, state->cli, state->fnum);
+       subreq = cli_smb2_close_fnum_send(state,
+                                         state->ev,
+                                         state->cli,
+                                         state->fnum,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index 0eb2a026527653023095a2cb4f622bb7c42993dd..7f3d7c2be1bf0bde9064e7237135aaee819a9a7b 100644 (file)
@@ -70,7 +70,8 @@ NTSTATUS cli_smb2_create_fnum(
 struct tevent_req *cli_smb2_close_fnum_send(TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
                                            struct cli_state *cli,
-                                           uint16_t fnum);
+                                           uint16_t fnum,
+                                           uint16_t flags);
 NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req);
 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
 struct tevent_req *cli_smb2_delete_on_close_send(TALLOC_CTX *mem_ctx,
index 46b9f27bf4e6019c5bf06fd7844eb644d2a3b943..fff450729369f8fde769d95decde603cb111dbee 100644 (file)
@@ -2048,8 +2048,11 @@ static void cli_smb2_hardlink_info_set(struct tevent_req *subreq)
 
        /* ignore error here, we need to close the file */
 
-       subreq = cli_smb2_close_fnum_send(
-               state, state->ev, state->cli, state->fnum_src);
+       subreq = cli_smb2_close_fnum_send(state,
+                                         state->ev,
+                                         state->cli,
+                                         state->fnum_src,
+                                         0);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -3648,10 +3651,7 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
        }
 
        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
-               subreq = cli_smb2_close_fnum_send(state,
-                                               ev,
-                                               cli,
-                                               fnum);
+               subreq = cli_smb2_close_fnum_send(state, ev, cli, fnum, 0);
                if (tevent_req_nomem(subreq, req)) {
                        return tevent_req_post(req, ev);
                }