mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
s3: VFS: vfs_cap. Implement renameat().
Currently identical to rename(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
365b81238e
commit
9859102b20
@ -259,6 +259,55 @@ static int cap_rename(vfs_handle_struct *handle,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cap_renameat(vfs_handle_struct *handle,
|
||||
files_struct *srcfsp,
|
||||
const struct smb_filename *smb_fname_src,
|
||||
files_struct *dstfsp,
|
||||
const struct smb_filename *smb_fname_dst)
|
||||
{
|
||||
char *capold = NULL;
|
||||
char *capnew = NULL;
|
||||
struct smb_filename *smb_fname_src_tmp = NULL;
|
||||
struct smb_filename *smb_fname_dst_tmp = NULL;
|
||||
int ret = -1;
|
||||
|
||||
capold = capencode(talloc_tos(), smb_fname_src->base_name);
|
||||
capnew = capencode(talloc_tos(), smb_fname_dst->base_name);
|
||||
if (!capold || !capnew) {
|
||||
errno = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Setup temporary smb_filename structs. */
|
||||
smb_fname_src_tmp = cp_smb_filename(talloc_tos(), smb_fname_src);
|
||||
if (smb_fname_src_tmp == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
smb_fname_dst_tmp = cp_smb_filename(talloc_tos(), smb_fname_dst);
|
||||
if (smb_fname_dst_tmp == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
smb_fname_src_tmp->base_name = capold;
|
||||
smb_fname_dst_tmp->base_name = capnew;
|
||||
|
||||
ret = SMB_VFS_NEXT_RENAMEAT(handle,
|
||||
srcfsp,
|
||||
smb_fname_src_tmp,
|
||||
dstfsp,
|
||||
smb_fname_dst_tmp);
|
||||
|
||||
out:
|
||||
TALLOC_FREE(capold);
|
||||
TALLOC_FREE(capnew);
|
||||
TALLOC_FREE(smb_fname_src_tmp);
|
||||
TALLOC_FREE(smb_fname_dst_tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cap_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
|
||||
{
|
||||
char *cappath;
|
||||
@ -1010,6 +1059,7 @@ static struct vfs_fn_pointers vfs_cap_fns = {
|
||||
.rmdir_fn = cap_rmdir,
|
||||
.open_fn = cap_open,
|
||||
.rename_fn = cap_rename,
|
||||
.renameat_fn = cap_renameat,
|
||||
.stat_fn = cap_stat,
|
||||
.lstat_fn = cap_lstat,
|
||||
.unlink_fn = cap_unlink,
|
||||
|
Loading…
x
Reference in New Issue
Block a user