diff options
-rw-r--r-- | source3/torture/cmd_vfs.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 667cc1678e..c7665656de 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -1147,6 +1147,41 @@ static NTSTATUS cmd_realpath(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg return NT_STATUS_OK; } +static NTSTATUS cmd_getxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + uint8_t *buf; + ssize_t ret; + + if (argc != 3) { + printf("Usage: getxattr <path> <xattr>\n"); + return NT_STATUS_OK; + } + + buf = NULL; + + ret = SMB_VFS_GETXATTR(vfs->conn, argv[1], argv[2], buf, + talloc_get_size(buf)); + if (ret == -1) { + int err = errno; + printf("getxattr returned (%s)\n", strerror(err)); + return map_nt_error_from_unix(err); + } + buf = talloc_array(mem_ctx, uint8_t, ret); + if (buf == NULL) { + return NT_STATUS_NO_MEMORY; + } + ret = SMB_VFS_GETXATTR(vfs->conn, argv[1], argv[2], buf, + talloc_get_size(buf)); + if (ret == -1) { + int err = errno; + printf("getxattr returned (%s)\n", strerror(err)); + return map_nt_error_from_unix(err); + } + dump_data_file(buf, talloc_get_size(buf), false, stdout); + return NT_STATUS_OK; +} + struct cmd_set vfs_commands[] = { { "VFS Commands" }, @@ -1187,5 +1222,7 @@ struct cmd_set vfs_commands[] = { { "link", cmd_link, "VFS link()", "link <oldpath> <newpath>" }, { "mknod", cmd_mknod, "VFS mknod()", "mknod <path> <mode> <dev>" }, { "realpath", cmd_realpath, "VFS realpath()", "realpath <path>" }, + { "getxattr", cmd_getxattr, "VFS getxattr()", + "getxattr <path> <name>" }, { NULL } }; |