From: Samuel Cabrero Date: Tue, 13 Apr 2021 15:05:57 +0000 (+0200) Subject: s3: smbd: Pass full fsp to file_ntimes() X-Git-Tag: tevent-0.11.0~1137 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1196903231013efa6499e71703fa12f7031f0dcd;p=thirdparty%2Fsamba.git s3: smbd: Pass full fsp to file_ntimes() Signed-off-by: Samuel Cabrero Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 915419c7e61..d831aa8d60f 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1203,7 +1203,8 @@ NTSTATUS file_set_sparse(connection_struct *conn, than POSIX. *******************************************************************/ -int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname, +int file_ntimes(connection_struct *conn, + files_struct *fsp, struct smb_file_time *ft) { int ret = -1; @@ -1230,7 +1231,7 @@ int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname, return 0; } - if(SMB_VFS_NTIMES(conn, smb_fname, ft) == 0) { + if (SMB_VFS_NTIMES(conn, fsp->fsp_name, ft) == 0) { return 0; } @@ -1250,12 +1251,12 @@ int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname, /* Check if we have write access. */ if (can_write_to_file(conn, - conn->cwd_fsp, - smb_fname)) + conn->cwd_fsp, + fsp->fsp_name)) { /* We are allowed to become root and change the filetime. */ become_root(); - ret = SMB_VFS_NTIMES(conn, smb_fname, ft); + ret = SMB_VFS_NTIMES(conn, fsp->fsp_name, ft); unbecome_root(); } diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index c3f55d1bdff..60e73d6e5e6 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -224,7 +224,7 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp, if (!is_omit_timespec(&ft.mtime)) { round_timespec(conn->ts_res, &ft.mtime); - file_ntimes(conn, fsp->fsp_name, &ft); + file_ntimes(conn, fsp, &ft); } ok = mark_share_mode_disconnected(lck, fsp); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 7c98fdeb0cd..b0707356b80 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -284,7 +284,8 @@ int file_set_dosmode(connection_struct *conn, NTSTATUS file_set_sparse(connection_struct *conn, struct files_struct *fsp, bool sparse); -int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname, +int file_ntimes(connection_struct *conn, + files_struct *fsp, struct smb_file_time *ft); bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime); bool set_sticky_write_time_fsp(struct files_struct *fsp, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 2dadd08944b..7c15a731e0d 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6622,7 +6622,7 @@ NTSTATUS smb_set_file_time(connection_struct *conn, DEBUG(10,("smb_set_file_time: setting utimes to modified values.\n")); - ret = file_ntimes(conn, set_fsp->fsp_name, ft); + ret = file_ntimes(conn, set_fsp, ft); if (ret != 0) { return map_nt_error_from_unix(errno); }