1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

smbd: add fstat_before_close fsp flag and logic

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2022-04-29 18:55:31 +02:00 committed by Jeremy Allison
parent 1dfa193232
commit f661ef67ba
2 changed files with 10 additions and 0 deletions

View File

@ -372,6 +372,7 @@
* Version 47 - Add SMB_VFS_GET_REAL_FILENAME_AT
* Version 47 - Replace SMB_VFS_GET_REAL_FILENAME with SMB_VFS_GET_REAL_FILENAME_AT
* Version 47 - Re-add dirfsp to CREATE_FILE
* Version 47 - Add fsp flag fstat_before_close
*/
#define SMB_VFS_INTERFACE_VERSION 47
@ -445,6 +446,7 @@ typedef struct files_struct {
bool closing : 1;
bool lock_failure_seen : 1;
bool encryption_required : 1;
bool fstat_before_close : 1;
} fsp_flags;
struct tevent_timer *update_write_time_event;

View File

@ -974,12 +974,20 @@ NTSTATUS fd_openat(const struct files_struct *dirfsp,
NTSTATUS fd_close(files_struct *fsp)
{
NTSTATUS status;
int ret;
if (fsp == fsp->conn->cwd_fsp) {
return NT_STATUS_OK;
}
if (fsp->fsp_flags.fstat_before_close) {
status = vfs_stat_fsp(fsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
}
if (fsp->dptr) {
dptr_CloseDir(fsp);
}