smbd: Rewrite non_widelink_open()
commit2c8935cf3d79dd09bc6d00793cf8fdaf031d21fc
authorVolker Lendecke <vl@samba.org>
Mon, 12 Sep 2022 19:08:13 +0000 (12 12:08 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 17 Sep 2022 04:15:35 +0000 (17 04:15 +0000)
tree0a0a44eeeff6c1e505e041cad701688fdf51c7a5
parent1bf0289b23cae861ec1fa3c4a46e267392315726
smbd: Rewrite non_widelink_open()

The previous implementation relied on recursion into
non_widelink_open() via process_symlink_open(). The latter used
readlink() to just make sure that the opened file is actually a
symlink.

This implementation now relies on a fstat/fstatat on failure to open a
file, removing a little complexity deciphering error codes
correctly. It also relies on reading the symlink in user space,
turning the recursion into a loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c