]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use parent_smb_fname() in smb_unix_mknod()
authorRalph Boehme <slow@samba.org>
Tue, 28 Apr 2020 15:08:53 +0000 (17:08 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 16:39:40 +0000 (16:39 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index 19706d32bd5d24b4b85aae3a26066a40c79ef273..37947d8139c39a59daf758bca4e0e127a860d241 100644 (file)
@@ -8143,14 +8143,21 @@ static NTSTATUS smb_unix_mknod(connection_struct *conn,
         */
 
        if (lp_inherit_permissions(SNUM(conn))) {
-               char *parent;
-               if (!parent_dirname(talloc_tos(), smb_fname->base_name,
-                                   &parent, NULL)) {
+               struct smb_filename *parent_fname = NULL;
+               bool ok;
+
+               ok = parent_smb_fname(talloc_tos(),
+                                     smb_fname,
+                                     &parent_fname,
+                                     NULL);
+               if (!ok) {
                        return NT_STATUS_NO_MEMORY;
                }
-               inherit_access_posix_acl(conn, parent, smb_fname,
+               inherit_access_posix_acl(conn,
+                                        parent_fname->base_name,
+                                        smb_fname,
                                         unixmode);
-               TALLOC_FREE(parent);
+               TALLOC_FREE(parent_fname);
        }
 
        return NT_STATUS_OK;