From 258952aa85f2a68e2d2362522f6114c6a439f1e3 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Thu, 2 Jul 2009 09:27:44 -0700 Subject: s3: Plumb smb_filename through SMB_VFS_UNLINK --- source3/modules/vfs_cap.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'source3/modules/vfs_cap.c') diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 4d16aa44ae6..9348ab9554c 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -226,15 +226,34 @@ static int cap_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname) return ret; } -static int cap_unlink(vfs_handle_struct *handle, const char *path) +static int cap_unlink(vfs_handle_struct *handle, + const struct smb_filename *smb_fname) { - char *cappath = capencode(talloc_tos(), path); + struct smb_filename *smb_fname_tmp = NULL; + char *cappath = NULL; + NTSTATUS status; + int ret; + cappath = capencode(talloc_tos(), smb_fname->base_name); if (!cappath) { errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_UNLINK(handle, cappath); + + /* Setup temporary smb_filename structs. */ + status = copy_smb_filename(talloc_tos(), smb_fname, + &smb_fname_tmp); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return -1; + } + + smb_fname_tmp->base_name = cappath; + + ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname_tmp); + + TALLOC_FREE(smb_fname_tmp); + return ret; } static int cap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) -- cgit v1.2.1