s3/torture: SMB_VFS_SETXATTR -> SMB_VFS_FSETXATTR
authorNoel Power <noel.power@suse.com>
Fri, 19 Feb 2021 09:17:57 +0000 (09:17 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 11 Mar 2021 17:50:30 +0000 (17:50 +0000)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/cmd_vfs.c

index 9b1fa1bbdfedaa347d00f90b82ab67eb51635a2a..8c4f3bdc7e70aa366635219f41d65b9171540a33 100644 (file)
@@ -1464,12 +1464,14 @@ static NTSTATUS cmd_listxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
-static NTSTATUS cmd_setxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
+static NTSTATUS cmd_fsetxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
                             int argc, const char **argv)
 {
        ssize_t ret;
        int flags = 0;
        struct smb_filename *smb_fname = NULL;
+       struct smb_filename *pathref_fname = NULL;
+       NTSTATUS status;
 
        if ((argc < 4) || (argc > 5)) {
                printf("Usage: setxattr <path> <xattr> <value> [flags]\n");
@@ -1486,11 +1488,24 @@ static NTSTATUS cmd_setxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
        if (smb_fname == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
-       ret = SMB_VFS_SETXATTR(vfs->conn, smb_fname, argv[2],
+
+       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)) {
+               return status;
+       }
+
+       ret = SMB_VFS_FSETXATTR(pathref_fname->fsp, argv[2],
                               argv[3], strlen(argv[3]), flags);
        if (ret == -1) {
                int err = errno;
-               printf("setxattr returned (%s)\n", strerror(err));
+               printf("fsetxattr returned (%s)\n", strerror(err));
                return map_nt_error_from_unix(err);
        }
        return NT_STATUS_OK;
@@ -2083,8 +2098,8 @@ struct cmd_set vfs_commands[] = {
          "getxattr <path> <name>" },
        { "listxattr", cmd_listxattr, "VFS listxattr()",
          "listxattr <path>" },
-       { "setxattr", cmd_setxattr, "VFS setxattr()",
-         "setxattr <path> <name> <value> [<flags>]" },
+       { "fsetxattr", cmd_fsetxattr, "VFS fsetxattr()",
+         "fsetxattr <path> <name> <value> [<flags>]" },
        { "removexattr", cmd_removexattr, "VFS removexattr()",
          "removexattr <path> <name>\n" },
        { "fget_nt_acl", cmd_fget_nt_acl, "VFS fget_nt_acl()",