-/*
- * Success: return NT_STATUS_OK
- * Failure: return NT status error
- * In this case, "name" is a path.
- */
-static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t security_info,
- TALLOC_CTX *mem_ctx,
- struct security_descriptor **ppdesc)
-{
- NTSTATUS status;
- char *clientPath;
- struct smb_filename *client_smb_fname = NULL;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n"));
- if (!is_in_media_files(smb_fname->base_name))
- {
- status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname,
- security_info,
- mem_ctx, ppdesc);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- smb_fname->base_name,
- &clientPath))
- {
- status = map_nt_error_from_unix(errno);
- goto err;
- }
-
- client_smb_fname = synthetic_smb_fname(talloc_tos(),
- clientPath,
- NULL,
- NULL,
- smb_fname->flags);
- if (client_smb_fname == NULL) {
- TALLOC_FREE(clientPath);
- return NT_STATUS_NO_MEMORY;
- }
-
- status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname,
- security_info,
- mem_ctx, ppdesc);
-err:
- TALLOC_FREE(clientPath);
- TALLOC_FREE(client_smb_fname);
-out:
- return status;
-}
-
-/*
- * Success: return 0
- * Failure: set errno, return -1
- */
-static int mh_chmod_acl(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- mode_t mode)
-{
- int status;
- struct smb_filename *clientFname = NULL;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_chmod_acl\n"));
- if (!is_in_media_files(smb_fname->base_name))
- {
- status = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
- goto out;
- }
-
- status = alloc_get_client_smb_fname(handle,
- talloc_tos(),
- smb_fname,
- &clientFname);
- if (status != 0) {
- goto err;
- }
-
- status = SMB_VFS_NEXT_CHMOD_ACL(handle, clientFname, mode);
-err:
- TALLOC_FREE(clientFname);
-out:
- return status;
-}
-
-/*
- * Success: return acl pointer
- * Failure: set errno, return NULL
- */
-static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
- const char *path_p,
- SMB_ACL_TYPE_T type,
- TALLOC_CTX *mem_ctx)
-{
- SMB_ACL_T ret;
- char *clientPath;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_get_file\n"));
- if (!is_in_media_files(path_p))
- {
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- path_p,
- &clientPath))
- {
- ret = NULL;
- goto err;
- }
-
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type, mem_ctx);
-err:
- TALLOC_FREE(clientPath);
-out:
- return ret;
-}
-
-/*
- * Success: return 0
- * Failure: set errno, return -1
- * In this case, "name" is a path.
- */
-static int mh_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int status;
- char *clientPath;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_set_file\n"));
- if (!is_in_media_files(name))
- {
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name,
- acltype, theacl);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- name,
- &clientPath)))
- {
- goto err;
- }
-
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientPath,
- acltype, theacl);
-err:
- TALLOC_FREE(clientPath);
-out:
- return status;
-}
-
-/*
- * Success: return 0
- * Failure: set errno, return -1
- */
-static int mh_sys_acl_delete_def_file(vfs_handle_struct *handle,
- const char *path)
-{
- int status;
- char *clientPath;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_delete_def_file\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle,
- path);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
- goto err;
- }
-
- status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, clientPath);
-err:
- TALLOC_FREE(clientPath);
-out:
- return status;
-}
-
-/*
- * Success: return positive number
- * Failure: set errno, return -1
- * In this case, "name" is an attr name.
- */
-static ssize_t mh_getxattr(struct vfs_handle_struct *handle,
- const char *path,
- const char *name,
- void *value,
- size_t size)
-{
- ssize_t ret;
- char *clientPath;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_getxattr\n"));
- if (!is_in_media_files(path))
- {
- ret = SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
- size);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- path,
- &clientPath))
- {
- ret = -1;
- goto err;
- }
-
- ret = SMB_VFS_NEXT_GETXATTR(handle, clientPath, name, value, size);
-err:
- TALLOC_FREE(clientPath);
-out:
- return ret;
-}
-
-/*
- * Success: return positive number
- * Failure: set errno, return -1
- */
-static ssize_t mh_listxattr(struct vfs_handle_struct *handle,
- const char *path,
- char *list,
- size_t size)
-{
- ssize_t ret;
- char *clientPath;
- TALLOC_CTX *ctx;
-
- DEBUG(MH_INFO_DEBUG, ("Entering mh_listxattr\n"));
- if (!is_in_media_files(path))
- {
- ret = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
- goto out;
- }
-
- clientPath = NULL;
- ctx = talloc_tos();
-
- if (alloc_get_client_path(handle, ctx,
- path,
- &clientPath))
- {
- ret = -1;
- goto err;
- }
-
- ret = SMB_VFS_NEXT_LISTXATTR(handle, clientPath, list, size);
-err:
- TALLOC_FREE(clientPath);
-out:
- return ret;
-}
-