summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2012-11-15 15:25:52 +0100
committerAndrew Bartlett <abartlet@samba.org>2013-02-04 12:19:30 +0100
commit8e571fd385334bc12ee5c5bdfd32b31ad2c4b4b8 (patch)
treed2be9995688e7266ff616bd97bfc332b3c32ffa5
parentde676555ab882bd110a2649555645d58abe2bfeb (diff)
downloadsamba-8e571fd385334bc12ee5c5bdfd32b31ad2c4b4b8.tar.gz
samba-8e571fd385334bc12ee5c5bdfd32b31ad2c4b4b8.tar.bz2
samba-8e571fd385334bc12ee5c5bdfd32b31ad2c4b4b8.zip
s3:torture/vfstest implement sys_acl_blob_get_fd
Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source3/torture/cmd_vfs.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index eef9c40c8e..15f0c5a54d 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -1642,6 +1642,49 @@ static NTSTATUS cmd_sys_acl_blob_get_file(struct vfs_state *vfs,
return NT_STATUS_OK;
}
+static NTSTATUS cmd_sys_acl_blob_get_fd(struct vfs_state *vfs,
+ TALLOC_CTX *mem_ctx,
+ int argc, const char **argv)
+{
+ int fd;
+ char *description;
+ DATA_BLOB blob;
+ int ret;
+ size_t i;
+
+ if (argc != 2) {
+ printf("Usage: sys_acl_blob_get_fd <fd>\n");
+ return NT_STATUS_OK;
+ }
+
+ fd = atoi(argv[1]);
+ if (fd < 0 || fd >= 1024) {
+ printf("sys_acl_blob_get_fd: error=%d "
+ "(file descriptor out of range)\n", EBADF);
+ return NT_STATUS_OK;
+ }
+ if (vfs->files[fd] == NULL) {
+ printf("sys_acl_blob_get_fd: error=%d "
+ "(invalid file descriptor)\n", EBADF);
+ return NT_STATUS_OK;
+ }
+
+ ret = SMB_VFS_SYS_ACL_BLOB_GET_FD(vfs->files[fd], talloc_tos(),
+ &description, &blob);
+ if (ret != 0) {
+ printf("sys_acl_blob_get_fd failed (%s)\n", strerror(errno));
+ return map_nt_error_from_unix(errno);
+ }
+ printf("Description: %s\n", description);
+ for (i = 0; i < blob.length; i++) {
+ printf("%.2x ", blob.data[i]);
+ }
+ printf("\n");
+
+ return NT_STATUS_OK;
+}
+
+
static NTSTATUS cmd_sys_acl_delete_def_file(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
@@ -1723,6 +1766,8 @@ struct cmd_set vfs_commands[] = {
{ "sys_acl_get_fd", cmd_sys_acl_get_fd, "VFS sys_acl_get_fd()", "sys_acl_get_fd <fd>" },
{ "sys_acl_blob_get_file", cmd_sys_acl_blob_get_file,
"VFS sys_acl_blob_get_file()", "sys_acl_blob_get_file <path>" },
+ { "sys_acl_blob_get_fd", cmd_sys_acl_blob_get_fd,
+ "VFS sys_acl_blob_get_fd()", "sys_acl_blob_get_fd <path>" },
{ "sys_acl_delete_def_file", cmd_sys_acl_delete_def_file, "VFS sys_acl_delete_def_file()", "sys_acl_delete_def_file <path>" },