]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: torture: Change cmd_sys_acl_blob_get_file() to be handle based.
authorJeremy Allison <jra@samba.org>
Tue, 8 Jun 2021 22:53:57 +0000 (15:53 -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 7ccf4346482965873f85821115be9e253b0a429f..5ba1e400b6eb84100a976d57a71f2d6410634247 100644 (file)
@@ -1893,23 +1893,43 @@ static NTSTATUS cmd_sys_acl_blob_get_file(struct vfs_state *vfs,
        int ret;
        size_t i;
        struct smb_filename *smb_fname = NULL;
+       struct smb_filename *pathref_fname = NULL;
+       NTSTATUS status;
 
        if (argc != 2) {
-               printf("Usage: sys_acl_get_file <path>\n");
+               printf("Usage: sys_acl_blob_get_file <path>\n");
                return NT_STATUS_OK;
        }
 
-       smb_fname = synthetic_smb_fname_split(talloc_tos(),
+       smb_fname = synthetic_smb_fname_split(mem_ctx,
                                        argv[1],
                                        lp_posix_pathnames());
        if (smb_fname == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
-       ret = SMB_VFS_SYS_ACL_BLOB_GET_FILE(vfs->conn, smb_fname, talloc_tos(),
-                                           &description, &blob);
+       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;
+       }
+
+       ret = SMB_VFS_SYS_ACL_BLOB_GET_FD(pathref_fname->fsp,
+                                         talloc_tos(),
+                                         &description,
+                                         &blob);
        if (ret != 0) {
+               status = map_nt_error_from_unix(errno);
                printf("sys_acl_blob_get_file failed (%s)\n", strerror(errno));
-               return map_nt_error_from_unix(errno);
+               TALLOC_FREE(smb_fname);
+               TALLOC_FREE(pathref_fname);
+               return status;
        }
        printf("Description: %s\n", description);
        for (i = 0; i < blob.length; i++) {
@@ -1917,6 +1937,8 @@ static NTSTATUS cmd_sys_acl_blob_get_file(struct vfs_state *vfs,
        }
        printf("\n");
 
+       TALLOC_FREE(smb_fname);
+       TALLOC_FREE(pathref_fname);
        return NT_STATUS_OK;
 }