From: Volker Lendecke Date: Tue, 14 Jun 2022 14:15:15 +0000 (+0200) Subject: smbd: Some more assert in fd_openat() X-Git-Tag: tevent-0.13.0~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87f03333e8b13b1a145b8332bb93f9603c170905;p=thirdparty%2Fsamba.git smbd: Some more assert in fd_openat() Before this patch we asserted that if we have a base_fsp then smb_fname must have a stream name attached. Now we also assert that if we don't have a base_fsp smb_fname is not a stream. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 16e691766e5..3a8c0bf9c48 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -879,6 +879,10 @@ NTSTATUS fd_openat(const struct files_struct *dirfsp, { struct connection_struct *conn = fsp->conn; NTSTATUS status = NT_STATUS_OK; + bool fsp_is_stream = fsp_is_alternate_stream(fsp); + bool smb_fname_is_stream = is_named_stream(smb_fname); + + SMB_ASSERT(fsp_is_stream == smb_fname_is_stream); /* * Never follow symlinks on a POSIX client. The @@ -889,11 +893,9 @@ NTSTATUS fd_openat(const struct files_struct *dirfsp, flags |= O_NOFOLLOW; } - if (fsp_is_alternate_stream(fsp)) { + if (fsp_is_stream) { int fd; - SMB_ASSERT(is_named_stream(smb_fname)); - fd = SMB_VFS_OPENAT( conn, NULL, /* stream open is relative to fsp->base_fsp */