]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: torture: cmd_sys_acl_get_file(), SMB_VFS_SYS_ACL_GET_FILE() -> SMB_VFS_SYS_ACL_GE...
authorJeremy Allison <jra@samba.org>
Wed, 2 Jun 2021 17:52:47 +0000 (10:52 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:30 +0000 (13:14 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/torture/cmd_vfs.c

index de41554dba93c27c298f1937fc93c85cbbc3820e..7ccf4346482965873f85821115be9e253b0a429f 100644 (file)
@@ -1838,6 +1838,8 @@ static NTSTATUS cmd_sys_acl_get_file(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
        char *acl_text;
        int type;
        struct smb_filename *smb_fname = NULL;
+       struct smb_filename *pathref_fname = NULL;
+       NTSTATUS status;
 
        if (argc != 3) {
                printf("Usage: sys_acl_get_file <path> <type>\n");
@@ -1851,15 +1853,33 @@ static NTSTATUS cmd_sys_acl_get_file(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
        type = atoi(argv[2]);
-       acl = SMB_VFS_SYS_ACL_GET_FILE(vfs->conn, smb_fname,
+
+       status = synthetic_pathref(mem_ctx,
+                               vfs->conn->cwd_fsp,
+                               smb_fname->base_name,
+                               NULL,
+                               NULL,
+                               smb_fname->twrp,
+                               smb_fname->flags,
+                               &pathref_fname);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(smb_fname);
+               return status;
+       }
+
+       acl = SMB_VFS_SYS_ACL_GET_FD(pathref_fname->fsp,
                                type, talloc_tos());
        if (!acl) {
-               printf("sys_acl_get_file failed (%s)\n", strerror(errno));
+               printf("sys_acl_get_fd failed (%s)\n", strerror(errno));
+               TALLOC_FREE(smb_fname);
+               TALLOC_FREE(pathref_fname);
                return NT_STATUS_UNSUCCESSFUL;
        }
        acl_text = sys_acl_to_text(acl, NULL);
        printf("%s", acl_text);
        TALLOC_FREE(acl);
+       TALLOC_FREE(smb_fname);
+       TALLOC_FREE(pathref_fname);
        SAFE_FREE(acl_text);
        return NT_STATUS_OK;
 }