s3: smbd: Change set_create_timespec_ea() to take the existing fsp.
authorJeremy Allison <jra@samba.org>
Thu, 20 May 2021 16:28:29 +0000 (09:28 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 20 May 2021 19:59:44 +0000 (19:59 +0000)
Removes an unneeded synthetic_pathref() call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May 20 19:59:44 UTC 2021 on sn-devel-184

source3/modules/vfs_default.c
source3/smbd/dosmode.c
source3/smbd/proto.h

index 50b00de23013c4aa6642879edff3aebe05106db8..e384f8885d1fa3b521da768cff597e31215dc5a6 100644 (file)
@@ -2541,8 +2541,7 @@ static int vfswrap_fntimes(vfs_handle_struct *handle,
                }
 
                if (!is_omit_timespec(&ft->create_time)) {
-                       set_create_timespec_ea(handle->conn,
-                                              fsp->fsp_name,
+                       set_create_timespec_ea(fsp,
                                               ft->create_time);
                }
 
index d5bb9e1fd41578cb6e02b09be1d7e7561792b131..a858edee55859ffcb6bd4136a392df6e3b091f8f 100644 (file)
@@ -1302,51 +1302,27 @@ bool set_sticky_write_time_fsp(struct files_struct *fsp, struct timespec mtime)
  Set a create time EA.
 ******************************************************************/
 
-NTSTATUS set_create_timespec_ea(connection_struct *conn,
-                               const struct smb_filename *psmb_fname,
+NTSTATUS set_create_timespec_ea(struct files_struct *fsp,
                                struct timespec create_time)
 {
-       struct smb_filename *smb_fname;
        uint32_t dosmode;
        int ret;
-       NTSTATUS status;
 
-       if (!lp_store_dos_attributes(SNUM(conn))) {
+       if (!lp_store_dos_attributes(SNUM(fsp->conn))) {
                return NT_STATUS_OK;
        }
 
-       status = synthetic_pathref(talloc_tos(),
-                                       conn->cwd_fsp,
-                                       psmb_fname->base_name,
-                                       NULL,
-                                       NULL,
-                                       psmb_fname->twrp,
-                                       psmb_fname->flags,
-                                       &smb_fname);
-
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       dosmode = fdos_mode(psmb_fname->fsp);
+       dosmode = fdos_mode(fsp);
 
-       smb_fname->st.st_ex_btime = create_time;
-       /*
-        * ensure if we pass fsp around we can get the create time
-        * from fsp->fsp_name
-        */
-       smb_fname->fsp->fsp_name->st.st_ex_btime = create_time;
-
-       ret = file_set_dosmode(conn, smb_fname, dosmode, NULL, false);
+       fsp->fsp_name->st.st_ex_btime = create_time;
+       ret = file_set_dosmode(fsp->conn, fsp->fsp_name, dosmode, NULL, false);
        if (ret == -1) {
-               TALLOC_FREE(smb_fname);
                return map_nt_error_from_unix(errno);
        }
 
-       DEBUG(10,("set_create_timespec_ea: wrote create time EA for file %s\n",
-               smb_fname_str_dbg(smb_fname)));
+       DBG_DEBUG("wrote create time EA for file %s\n",
+               smb_fname_str_dbg(fsp->fsp_name));
 
-       TALLOC_FREE(smb_fname);
        return NT_STATUS_OK;
 }
 
index 1eb74628218b42f6e9a0703bb25407cbec90da65..b9131ba5bd945ef5ab7cd0269306928ec8f37cfe 100644 (file)
@@ -297,8 +297,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
                              const struct smb_filename *smb_fname,
                              uint32_t dosmode);
 
-NTSTATUS set_create_timespec_ea(connection_struct *conn,
-                               const struct smb_filename *smb_fname,
+NTSTATUS set_create_timespec_ea(struct files_struct *fsp,
                                struct timespec create_time);
 
 struct timespec get_create_timespec(connection_struct *conn,