]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use parent_smb_fname() in inherit_new_acl()
authorRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 14:52:09 +0000 (16:52 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:40 +0000 (16:39 +0000)
Note: has to rename the variable parent_smb_fname otherwise it conflicts with
the function name.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index ea7f66f82cf423651abc649312217fb4e6018c17..63adfabee4c9e328372baaf7835a50e174c6dfe3 100644 (file)
@@ -4813,7 +4813,6 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
 static NTSTATUS inherit_new_acl(files_struct *fsp)
 {
        TALLOC_CTX *frame = talloc_stackframe();
-       char *parent_name = NULL;
        struct security_descriptor *parent_desc = NULL;
        NTSTATUS status = NT_STATUS_OK;
        struct security_descriptor *psd = NULL;
@@ -4831,25 +4830,20 @@ static NTSTATUS inherit_new_acl(files_struct *fsp)
        const struct dom_sid *SY_U_sid = NULL;
        const struct dom_sid *SY_G_sid = NULL;
        size_t size = 0;
-       struct smb_filename *parent_smb_fname = NULL;
-
-       if (!parent_dirname(frame, fsp->fsp_name->base_name, &parent_name, NULL)) {
-               TALLOC_FREE(frame);
-               return NT_STATUS_NO_MEMORY;
-       }
-       parent_smb_fname = synthetic_smb_fname(talloc_tos(),
-                                               parent_name,
-                                               NULL,
-                                               NULL,
-                                               fsp->fsp_name->flags);
+       struct smb_filename *parent_dir = NULL;
+       bool ok;
 
-       if (parent_smb_fname == NULL) {
+       ok = parent_smb_fname(frame,
+                             fsp->fsp_name,
+                             &parent_dir,
+                             NULL);
+       if (!ok) {
                TALLOC_FREE(frame);
                return NT_STATUS_NO_MEMORY;
        }
 
        status = SMB_VFS_GET_NT_ACL(fsp->conn,
-                                   parent_smb_fname,
+                                   parent_dir,
                                    (SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL),
                                    frame,
                                    &parent_desc);
@@ -4901,7 +4895,6 @@ static NTSTATUS inherit_new_acl(files_struct *fsp)
 
        if (try_builtin_administrators) {
                struct unixid ids;
-               bool ok;
 
                ZERO_STRUCT(ids);
                ok = sids_to_unixids(&global_sid_Builtin_Administrators, 1, &ids);
@@ -4925,7 +4918,6 @@ static NTSTATUS inherit_new_acl(files_struct *fsp)
 
        if (try_system) {
                struct unixid ids;
-               bool ok;
 
                ZERO_STRUCT(ids);
                ok = sids_to_unixids(&global_sid_System, 1, &ids);