From: Jeremy Allison Date: Thu, 12 Sep 2019 19:01:42 +0000 (-0700) Subject: s3: VFS: vfs_posix_eadb. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~649 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19c8cfa2871050c857c4ad8eecc8dd0f99cfafdb;p=thirdparty%2Fsamba.git s3: VFS: vfs_posix_eadb. 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_posix_eadb.c b/source3/modules/vfs_posix_eadb.c index 44bef9f9d82..e60c39a5e6a 100644 --- a/source3/modules/vfs_posix_eadb.c +++ b/source3/modules/vfs_posix_eadb.c @@ -385,6 +385,22 @@ static int posix_eadb_rmdir(vfs_handle_struct *handle, return ret; } +static int posix_eadb_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 = posix_eadb_rmdir(handle, smb_fname); + } else { + ret = posix_eadb_unlink(handle, smb_fname); + } + return ret; +} + /* * Destructor for the VFS private data */ @@ -441,6 +457,7 @@ static struct vfs_fn_pointers vfs_posix_eadb_fns = { .removexattr_fn = posix_eadb_removexattr, .fremovexattr_fn = posix_eadb_fremovexattr, .unlink_fn = posix_eadb_unlink, + .unlinkat_fn = posix_eadb_unlinkat, .rmdir_fn = posix_eadb_rmdir, .connect_fn = posix_eadb_connect, };