-static NTSTATUS catia_get_nt_acl_at(struct vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- const struct smb_filename *smb_fname,
- uint32_t security_info,
- TALLOC_CTX *mem_ctx,
- struct security_descriptor **ppdesc)
-{
- char *mapped_name = NULL;
- const char *path = smb_fname->base_name;
- struct smb_filename *mapped_smb_fname = NULL;
- NTSTATUS status;
-
- SMB_ASSERT(dirfsp == handle->conn->cwd_fsp);
-
- status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return status;
- }
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- return NT_STATUS_NO_MEMORY;
- }
-
- status = SMB_VFS_NEXT_GET_NT_ACL_AT(handle,
- dirfsp,
- mapped_smb_fname,
- security_info,
- mem_ctx,
- ppdesc);
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_smb_fname);
-
- return status;
-}
-
-static SMB_ACL_T
-catia_sys_acl_get_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- TALLOC_CTX *mem_ctx)
-{
- char *mapped_name = NULL;
- struct smb_filename *mapped_smb_fname = NULL;
- NTSTATUS status;
- SMB_ACL_T ret;
- int saved_errno = 0;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return (SMB_ACL_T)NULL;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- errno = ENOMEM;
- return (SMB_ACL_T)NULL;
- }
-
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_smb_fname,
- type, mem_ctx);
- if (ret == (SMB_ACL_T)NULL) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_smb_fname);
- TALLOC_FREE(mapped_name);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return ret;
-}
-
-static int
-catia_sys_acl_delete_def_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- int saved_errno = 0;
- char *mapped_name = NULL;
- NTSTATUS status;
- int ret;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- errno = ENOMEM;
- return -1;
- }
- ret = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, mapped_smb_fname);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_smb_fname);
- TALLOC_FREE(mapped_name);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
- return ret;
-}
-
-static ssize_t
-catia_getxattr(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name,
- void *value,
- size_t size)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- char *mapped_name = NULL;
- char *mapped_ea_name = NULL;
- NTSTATUS status;
- ssize_t ret;
- int saved_errno = 0;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- status = catia_string_replace_allocate(handle->conn,
- name, &mapped_ea_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(mapped_name);
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_GETXATTR(handle, mapped_smb_fname,
- mapped_ea_name, value, size);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- TALLOC_FREE(mapped_smb_fname);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
-
- return ret;
-}
-
-static ssize_t
-catia_listxattr(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- char *list, size_t size)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- char *mapped_name = NULL;
- NTSTATUS status;
- ssize_t ret;
- int saved_errno = 0;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_LISTXATTR(handle, mapped_smb_fname, list, size);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_smb_fname);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
-
- return ret;
-}
-
-static int
-catia_removexattr(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- char *mapped_name = NULL;
- char *mapped_ea_name = NULL;
- NTSTATUS status;
- ssize_t ret;
- int saved_errno = 0;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- status = catia_string_replace_allocate(handle->conn,
- name, &mapped_ea_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(mapped_name);
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_REMOVEXATTR(handle, mapped_smb_fname,
- mapped_ea_name);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- TALLOC_FREE(mapped_smb_fname);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
-
- return ret;
-}
-
-static int
-catia_setxattr(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name,
- const void *value,
- size_t size,
- int flags)
-{
- struct smb_filename *mapped_smb_fname = NULL;
- char *mapped_name = NULL;
- char *mapped_ea_name = NULL;
- NTSTATUS status;
- ssize_t ret;
- int saved_errno = 0;
-
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- status = catia_string_replace_allocate(handle->conn,
- name, &mapped_ea_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(mapped_name);
- errno = map_errno_from_nt_status(status);
- return -1;
- }
-
- mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
- mapped_name,
- NULL,
- &smb_fname->st,
- smb_fname->twrp,
- smb_fname->flags);
- if (mapped_smb_fname == NULL) {
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_SETXATTR(handle, mapped_smb_fname, mapped_ea_name,
- value, size, flags);
- if (ret == -1) {
- saved_errno = errno;
- }
- TALLOC_FREE(mapped_name);
- TALLOC_FREE(mapped_ea_name);
- TALLOC_FREE(mapped_smb_fname);
- if (saved_errno != 0) {
- errno = saved_errno;
- }
-
- return ret;
-}
-