]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Pass full fsp to file_ntimes()
authorSamuel Cabrero <scabrero@samba.org>
Tue, 13 Apr 2021 15:05:57 +0000 (17:05 +0200)
committerSamuel Cabrero <scabrero@sn-devel-184>
Mon, 19 Apr 2021 12:28:30 +0000 (12:28 +0000)
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dosmode.c
source3/smbd/durable.c
source3/smbd/proto.h
source3/smbd/trans2.c

index 915419c7e617c05a66818d8f5a22ad20c8f30879..d831aa8d60f7874a297b69dc6e8af57694a035be 100644 (file)
@@ -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();
        }
 
index c3f55d1bdffe6a10f480d09c192945e62686a78b..60e73d6e5e6557de341f859d35b11404a4765816 100644 (file)
@@ -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);
index 7c98fdeb0cdea17c7f34cef9af34b7c9a2e9f4a2..b0707356b8010397c0de94f57fabfe31052e67d7 100644 (file)
@@ -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,
index 2dadd08944b2a45b0b69b5b6d78a22073f8172be..7c15a731e0d062be9ff1acfee71b0bf9c42d11a8 100644 (file)
@@ -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);
        }