From 5dddd9429e9b08b3d88ed6ba8fc86ec837ef23d8 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 10 Oct 2012 16:53:43 +1100 Subject: vfs: Use posix_sys_acl_blob_get_file in vfs_fake_acls for posix ACLs --- source3/modules/vfs_fake_acls.c | 69 ++--------------------------------------- 1 file changed, 2 insertions(+), 67 deletions(-) diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index a6e01b061e..df9c3f6641 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -299,71 +299,6 @@ static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle, } -static int fake_acls_sys_acl_blob_get_file(struct vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T type, TALLOC_CTX *mem_ctx, - char **blob_description, DATA_BLOB *blob) -{ - ssize_t length; - const char *name = NULL; - switch (type) { - case SMB_ACL_TYPE_ACCESS: - name = FAKE_ACL_ACCESS_XATTR; - break; - case SMB_ACL_TYPE_DEFAULT: - name = FAKE_ACL_DEFAULT_XATTR; - break; - } - - *blob_description = talloc_strdup(mem_ctx, "fake_acls"); - if (!*blob_description) { - errno = ENOMEM; - return -1; - } - - *blob = data_blob_null; - do { - blob->length += 1000; - blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, blob->length); - if (!blob->data) { - errno = ENOMEM; - return -1; - } - length = SMB_VFS_NEXT_GETXATTR(handle, path, name, blob->data, blob->length); - blob->length = length; - } while (length == -1 && errno == ERANGE); - if (length == -1) { - return -1; - } - return 0; -} - -static int fake_acls_sys_acl_blob_get_fd(struct vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx, - char **blob_description, DATA_BLOB *blob) -{ - ssize_t length; - const char *name = FAKE_ACL_ACCESS_XATTR; - - *blob_description = talloc_strdup(mem_ctx, "fake_acls"); - if (!*blob_description) { - errno = ENOMEM; - return -1; - } - *blob = data_blob_null; - do { - blob->length += 1000; - blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, blob->length); - if (!blob->data) { - errno = ENOMEM; - return -1; - } - length = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, blob->data, blob->length); - blob->length = length; - } while (length == -1 && errno == ERANGE); - if (length == -1) { - return -1; - } - return 0; -} - static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { int ret; @@ -520,8 +455,8 @@ static struct vfs_fn_pointers vfs_fake_acls_fns = { .fstat_fn = fake_acls_fstat, .sys_acl_get_file_fn = fake_acls_sys_acl_get_file, .sys_acl_get_fd_fn = fake_acls_sys_acl_get_fd, - .sys_acl_blob_get_file_fn = fake_acls_sys_acl_blob_get_file, - .sys_acl_blob_get_fd_fn = fake_acls_sys_acl_blob_get_fd, + .sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file, + .sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd, .sys_acl_set_file_fn = fake_acls_sys_acl_set_file, .sys_acl_set_fd_fn = fake_acls_sys_acl_set_fd, .sys_acl_delete_def_file_fn = fake_acls_sys_acl_delete_def_file, -- cgit