]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: convert inherit_from_dir arg of change_file_owner_to_parent() to struct smb_fil...
authorRalph Boehme <slow@samba.org>
Wed, 29 Apr 2020 09:03:11 +0000 (11:03 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:41 +0000 (16:39 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c
source3/smbd/proto.h

index 9c7418022a00e99957def02df45c24de2644bc83..1aa7ca5536c75a17c98c9c04cae03e6b6a9c02f7 100644 (file)
@@ -838,21 +838,11 @@ NTSTATUS fd_close(files_struct *fsp)
 ****************************************************************************/
 
 void change_file_owner_to_parent(connection_struct *conn,
-                                       const char *inherit_from_dir,
-                                       files_struct *fsp)
+                                struct smb_filename *smb_fname_parent,
+                                files_struct *fsp)
 {
-       struct smb_filename *smb_fname_parent;
        int ret;
 
-       smb_fname_parent = synthetic_smb_fname(talloc_tos(),
-                                       inherit_from_dir,
-                                       NULL,
-                                       NULL,
-                                       0);
-       if (smb_fname_parent == NULL) {
-               return;
-       }
-
        ret = SMB_VFS_STAT(conn, smb_fname_parent);
        if (ret == -1) {
                DEBUG(0,("change_file_owner_to_parent: failed to stat parent "
@@ -889,8 +879,6 @@ void change_file_owner_to_parent(connection_struct *conn,
                /* Ensure the uid entry is updated. */
                fsp->fsp_name->st.st_ex_uid = smb_fname_parent->st.st_ex_uid;
        }
-
-       TALLOC_FREE(smb_fname_parent);
 }
 
 static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
@@ -1347,7 +1335,7 @@ static NTSTATUS open_file(files_struct *fsp,
                        /* Change the owner if required. */
                        if (lp_inherit_owner(SNUM(conn)) != INHERIT_OWNER_NO) {
                                change_file_owner_to_parent(conn,
-                                                           parent_dir->base_name,
+                                                           parent_dir,
                                                            fsp);
                                need_re_stat = true;
                        }
index cee7f80a420fb737bb1508f89c5dd513e60bd540..04f168dddfd9c9725a7b022fd6e354277607092c 100644 (file)
@@ -709,7 +709,7 @@ NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp,
                 int flags, mode_t mode);
 NTSTATUS fd_close(files_struct *fsp);
 void change_file_owner_to_parent(connection_struct *conn,
-                                const char *inherit_from_dir,
+                                struct smb_filename *inherit_from_dir,
                                 files_struct *fsp);
 bool is_stat_open(uint32_t access_mask);
 NTSTATUS send_break_message(struct messaging_context *msg_ctx,