From: Volker Lendecke Date: Thu, 2 Feb 2012 18:36:00 +0000 (+0100) Subject: s3-vfstest: Add setxattr X-Git-Url: http://git.samba.org/?p=tridge%2Fsamba.git;a=commitdiff_plain;h=dbe9ff29996287e6b91b69cd56d61e0a83f551a7 s3-vfstest: Add setxattr --- diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 786eeb8ced..9e1c62db10 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -1228,6 +1228,31 @@ 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, + int argc, const char **argv) +{ + ssize_t ret; + int flags = 0; + + if ((argc < 4) || (argc > 5)) { + printf("Usage: setxattr [flags]\n"); + return NT_STATUS_OK; + } + + if (argc == 5) { + flags = atoi(argv[4]); + } + + ret = SMB_VFS_SETXATTR(vfs->conn, argv[1], argv[2], + argv[3], strlen(argv[3]), flags); + if (ret == -1) { + int err = errno; + printf("setxattr returned (%s)\n", strerror(err)); + return map_nt_error_from_unix(err); + } + return NT_STATUS_OK; +} + struct cmd_set vfs_commands[] = { { "VFS Commands" }, @@ -1272,5 +1297,7 @@ struct cmd_set vfs_commands[] = { "getxattr " }, { "listxattr", cmd_listxattr, "VFS listxattr()", "listxattr " }, + { "setxattr", cmd_setxattr, "VFS setxattr()", + "setxattr []" }, { NULL } };