smbd: Simplify non_widelink_open()
commit688604a423bb4dbb36ea6bc86e629d6ab0c4082d
authorVolker Lendecke <vl@samba.org>
Fri, 4 Mar 2022 13:56:24 +0000 (4 14:56 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 10 Mar 2022 19:19:06 +0000 (10 19:19 +0000)
treea13d6a0b2e207106996e28e15f590427798a45ec
parent854e8091b78dfcfb909dc34f5d1943fa0dd7deb1
smbd: Simplify non_widelink_open()

Don't depend on fsp->fsp_flags.is_directory: We can always take the
parent directory fname, chdir into it and openat(O_PATH|O_NOFOLLOW)
the relative file name. To properly handle the symlink case without
having O_PATH, upon failure we need the call to
fstatat(AT_SYMLINK_NOFOLLOW) as a replacement for the fstat-call that
we can do when we successfully opened the relative file name with
O_NOFOLLOW.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 10 19:19:06 UTC 2022 on sn-devel-184
source3/smbd/open.c