s3: smbd: Add "enum file_close_type close_type" parameter to close_cnum().
authorJeremy Allison <jra@samba.org>
Wed, 17 Aug 2022 18:35:29 +0000 (11:35 -0700)
committerNoel Power <npower@samba.org>
Thu, 18 Aug 2022 13:07:34 +0000 (13:07 +0000)
Not yet used, but needed so we can differentiate between
SHUTDOWN_CLOSE and ERROR_CLOSE in smbXsrv_tcon_disconnect()
if we fail to chdir. In that case we want to close the fd,
but not run any delete-on-close actions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15128

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/smbd/proto.h
source3/smbd/smb2_service.c
source3/smbd/smbXsrv_tcon.c

index 5ac0f713958268b3fe028bd2d0a45ca2aad93e2b..b8d0a5240610fddf182f37129147a9ba0660f723 100644 (file)
@@ -1053,7 +1053,9 @@ NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
                              int snum,
                              struct smbXsrv_session *session,
                              const char *pdev);
-void close_cnum(connection_struct *conn, uint64_t vuid);
+void close_cnum(connection_struct *conn,
+               uint64_t vuid,
+               enum file_close_type close_type);
 
 /* The following definitions come from smbd/session.c  */
 struct sessionid;
index e7a382415150d749370fb114328832e1dacd6ba3..4aa09c966c5d0a07d749d878241508123602abec 100644 (file)
@@ -932,7 +932,9 @@ connection_struct *make_connection_smb2(struct smbd_smb2_request *req,
  Close a cnum.
 ****************************************************************************/
 
-void close_cnum(connection_struct *conn, uint64_t vuid)
+void close_cnum(connection_struct *conn,
+               uint64_t vuid,
+               enum file_close_type close_type)
 {
        char rootpath[2] = { '/', '\0'};
        struct smb_filename root_fname = { .base_name = rootpath };
index b515b19e88f9cce1dc80196e7313813293ad9d0c..8707082edd6306540bd6230094890c95663c843e 100644 (file)
@@ -921,12 +921,12 @@ NTSTATUS smbXsrv_tcon_disconnect(struct smbXsrv_tcon *tcon, uint64_t vuid)
                         * removed from the linked list
                         * conn->sconn->connections.
                         */
-                       close_cnum(tcon->compat, vuid);
+                       close_cnum(tcon->compat, vuid, ERROR_CLOSE);
                        tcon->compat = NULL;
                        return status;
                }
 
-               close_cnum(tcon->compat, vuid);
+               close_cnum(tcon->compat, vuid, SHUTDOWN_CLOSE);
                tcon->compat = NULL;
        }