From: Volker Lendecke Date: Fri, 11 Feb 2022 09:20:54 +0000 (+0100) Subject: vfs: Simplify streams_xattr_unlinkat() X-Git-Tag: tevent-0.12.0~732 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30bbff383e7f084ef7da7b14ba8a35d73a5da2f2;p=thirdparty%2Fsamba.git vfs: Simplify streams_xattr_unlinkat() It would be a logic error to call rmdir on a stream. This simplifies the logic a bit. Signed-off-by: Volker Lendecke --- diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 156a1d65133..48fc1cd134b 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -474,7 +474,7 @@ static int streams_xattr_close(vfs_handle_struct *handle, return ret; } -static int streams_xattr_unlink_internal(vfs_handle_struct *handle, +static int streams_xattr_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, int flags) @@ -490,6 +490,9 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle, flags); } + /* A stream can never be rmdir'ed */ + SMB_ASSERT((flags & AT_REMOVEDIR) == 0); + status = streams_xattr_get_name(handle, talloc_tos(), smb_fname->stream_name, &xattr_name); if (!NT_STATUS_IS_OK(status)) { @@ -514,26 +517,6 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle, return ret; } -static int streams_xattr_unlinkat(vfs_handle_struct *handle, - struct files_struct *dirfsp, - const struct smb_filename *smb_fname, - int flags) -{ - int ret; - if (flags & AT_REMOVEDIR) { - ret = SMB_VFS_NEXT_UNLINKAT(handle, - dirfsp, - smb_fname, - flags); - } else { - ret = streams_xattr_unlink_internal(handle, - dirfsp, - smb_fname, - flags); - } - return ret; -} - static int streams_xattr_renameat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *smb_fname_src,