]> git.ipfire.org Git - thirdparty/samba.git/commit
smbd: Simplify OpenDir_from_pathref()
authorVolker Lendecke <vl@samba.org>
Thu, 10 Oct 2024 15:16:02 +0000 (17:16 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 12 Nov 2024 18:07:33 +0000 (18:07 +0000)
commitc0bbeded932f00b0cdc3954d549d6566c85fdc0b
treee966506ac04fb9298d1d4b096bd2b10a910f1867
parent9550f4370e47d765b8a23a8be91fe54d097b67aa
smbd: Simplify OpenDir_from_pathref()

Use the /proc/self/fd trick to make get_real_filename_fullscan_at look
a bit nicer and faster in strace. Direct SMB_VFS_OPENAT also is
cheaper in user space, we don't need the full fd_openat and
non_widelink_open magic here.

Also avoid opening ".", which can fail where a full path open would
succeed: If the directory in question does not give "x" perms to the
user, we get a handle on the dir as such but can't cd into it.

I haven't seen real-world cases of this, but one of our tests creates
such a scenario. I have further refactoring in my local tree that make
this patch necessary.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dir.c
source3/smbd/files.c
source3/smbd/proto.h