From: Jeremy Allison Date: Thu, 12 Sep 2019 20:41:10 +0000 (-0700) Subject: s3: VFS: vfs_streams_depot. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~633 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c81932fdfea44f466afc4726e5facd23ac92bbfa;p=thirdparty%2Fsamba.git s3: VFS: vfs_streams_depot. Implement unlinkat(). Note this isn't identical to unlink() as this must cope with (flags & AT_REMOVEDIR), which is identical to rmdir(). It calls either unlink or rmdir depending on the flags parameter. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index e9019037869..c85e4df6dbf 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -844,6 +844,21 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, return ret; } +static int streams_depot_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + int ret; + SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); + if (flags & AT_REMOVEDIR) { + ret = streams_depot_rmdir(handle, smb_fname); + } else { + ret = streams_depot_unlink(handle, smb_fname); + } + return ret; +} + static int streams_depot_renameat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *smb_fname_src, @@ -1080,6 +1095,7 @@ static struct vfs_fn_pointers vfs_streams_depot_fns = { .stat_fn = streams_depot_stat, .lstat_fn = streams_depot_lstat, .unlink_fn = streams_depot_unlink, + .unlinkat_fn = streams_depot_unlinkat, .rmdir_fn = streams_depot_rmdir, .renameat_fn = streams_depot_renameat, .streaminfo_fn = streams_depot_streaminfo,