diff options
author | Volker Lendecke <vl@samba.org> | 2012-02-02 16:36:18 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-02-02 20:35:27 +0100 |
commit | 7d72424f01f772147ceab3a1ed756dcdb8d240e8 (patch) | |
tree | c59009d6b5a7f5ac1e86cfa7ce354150e404ec3a | |
parent | c251667b4f799544b4d965492a9ce5f61ebefb61 (diff) | |
download | samba-7d72424f01f772147ceab3a1ed756dcdb8d240e8.tar.gz samba-7d72424f01f772147ceab3a1ed756dcdb8d240e8.tar.bz2 samba-7d72424f01f772147ceab3a1ed756dcdb8d240e8.zip |
s3-vfstest: Add getxattr
-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 } }; |