From 7d72424f01f772147ceab3a1ed756dcdb8d240e8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 2 Feb 2012 16:36:18 +0100 Subject: s3-vfstest: Add getxattr --- source3/torture/cmd_vfs.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source3') 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 \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 " }, { "mknod", cmd_mknod, "VFS mknod()", "mknod " }, { "realpath", cmd_realpath, "VFS realpath()", "realpath " }, + { "getxattr", cmd_getxattr, "VFS getxattr()", + "getxattr " }, { NULL } }; -- cgit