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

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 <vl@samba.org>
This commit is contained in:
Volker Lendecke 2022-02-11 10:20:54 +01:00 committed by Jeremy Allison
parent aacb3618c1
commit 30bbff383e

View File

@ -474,7 +474,7 @@ static int streams_xattr_close(vfs_handle_struct *handle,
return ret; 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, struct files_struct *dirfsp,
const struct smb_filename *smb_fname, const struct smb_filename *smb_fname,
int flags) int flags)
@ -490,6 +490,9 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
flags); flags);
} }
/* A stream can never be rmdir'ed */
SMB_ASSERT((flags & AT_REMOVEDIR) == 0);
status = streams_xattr_get_name(handle, talloc_tos(), status = streams_xattr_get_name(handle, talloc_tos(),
smb_fname->stream_name, &xattr_name); smb_fname->stream_name, &xattr_name);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
@ -514,26 +517,6 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
return ret; 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, static int streams_xattr_renameat(vfs_handle_struct *handle,
files_struct *srcfsp, files_struct *srcfsp,
const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_src,