]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: convert inherit_from_dir arg of change_dir_owner_to_parent() to struct smb_filename
authorRalph Boehme <slow@samba.org>
Wed, 29 Apr 2020 09:05:25 +0000 (11:05 +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

index 1aa7ca5536c75a17c98c9c04cae03e6b6a9c02f7..03505cab42c5d23f47ffc16e2748b4b312b02397 100644 (file)
@@ -882,26 +882,16 @@ void change_file_owner_to_parent(connection_struct *conn,
 }
 
 static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
-                                       const char *inherit_from_dir,
+                                       struct smb_filename *smb_fname_parent,
                                        struct smb_filename *smb_dname,
                                        SMB_STRUCT_STAT *psbuf)
 {
-       struct smb_filename *smb_fname_parent;
        struct smb_filename *smb_fname_cwd = NULL;
        struct smb_filename *saved_dir_fname = NULL;
        TALLOC_CTX *ctx = talloc_tos();
        NTSTATUS status = NT_STATUS_OK;
        int ret;
 
-       smb_fname_parent = synthetic_smb_fname(ctx,
-                                       inherit_from_dir,
-                                       NULL,
-                                       NULL,
-                                       0);
-       if (smb_fname_parent == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
        ret = SMB_VFS_STAT(conn, smb_fname_parent);
        if (ret == -1) {
                status = map_nt_error_from_unix(errno);
@@ -1000,7 +990,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
        vfs_ChDir(conn, saved_dir_fname);
  out:
        TALLOC_FREE(saved_dir_fname);
-       TALLOC_FREE(smb_fname_parent);
        TALLOC_FREE(smb_fname_cwd);
        return status;
 }
@@ -4164,7 +4153,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 
        /* Change the owner if required. */
        if (lp_inherit_owner(SNUM(conn)) != INHERIT_OWNER_NO) {
-               change_dir_owner_to_parent(conn, parent_dir,
+               change_dir_owner_to_parent(conn, parent_dir_fname,
                                           smb_dname,
                                           &smb_dname->st);
                need_re_stat = true;