From: Jeremy Allison Date: Wed, 17 Aug 2022 18:35:29 +0000 (-0700) Subject: s3: smbd: Add "enum file_close_type close_type" parameter to close_cnum(). X-Git-Tag: talloc-2.4.0~1405 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9203d17106c0e55a30813ff1ed76869c7581a343;p=thirdparty%2Fsamba.git s3: smbd: Add "enum file_close_type close_type" parameter to close_cnum(). 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 Reviewed-by: Noel Power --- diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 5ac0f713958..b8d0a524061 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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; diff --git a/source3/smbd/smb2_service.c b/source3/smbd/smb2_service.c index e7a38241515..4aa09c966c5 100644 --- a/source3/smbd/smb2_service.c +++ b/source3/smbd/smb2_service.c @@ -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 }; diff --git a/source3/smbd/smbXsrv_tcon.c b/source3/smbd/smbXsrv_tcon.c index b515b19e88f..8707082edd6 100644 --- a/source3/smbd/smbXsrv_tcon.c +++ b/source3/smbd/smbXsrv_tcon.c @@ -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; }