1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3: VFS: vfs_cap. Implement unlinkat().

This is identical to unlink(), as there
are no special cases needed for rmdir().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2019-09-12 09:36:34 -07:00 committed by Ralph Boehme
parent 95197108be
commit 4794e8dbb1

View File

@ -345,6 +345,39 @@ static int cap_unlink(vfs_handle_struct *handle,
return ret;
}
static int cap_unlinkat(vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
int flags)
{
struct smb_filename *smb_fname_tmp = NULL;
char *cappath = NULL;
int ret;
cappath = capencode(talloc_tos(), smb_fname->base_name);
if (!cappath) {
errno = ENOMEM;
return -1;
}
/* Setup temporary smb_filename structs. */
smb_fname_tmp = cp_smb_filename(talloc_tos(), smb_fname);
if (smb_fname_tmp == NULL) {
errno = ENOMEM;
return -1;
}
smb_fname_tmp->base_name = cappath;
ret = SMB_VFS_NEXT_UNLINKAT(handle,
dirfsp,
smb_fname_tmp,
flags);
TALLOC_FREE(smb_fname_tmp);
return ret;
}
static int cap_chmod(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
mode_t mode)
@ -1042,6 +1075,7 @@ static struct vfs_fn_pointers vfs_cap_fns = {
.stat_fn = cap_stat,
.lstat_fn = cap_lstat,
.unlink_fn = cap_unlink,
.unlinkat_fn = cap_unlinkat,
.chmod_fn = cap_chmod,
.chown_fn = cap_chown,
.lchown_fn = cap_lchown,