This is always a bug, we should never do this. In one iteration of my
code I was doing this, which led to an invalid fallback code, which
itself lead to an infinite recursion. Make this more obvious with an
assert.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Nov 12 15:13:03 UTC 2024 on atb-devel-224
files_struct *fsp,
const struct vfs_open_how *how)
{
+ int dirfd = fsp_get_pathref_fd(dirfsp);
int flags = how->flags;
mode_t mode = how->mode;
bool have_opath = false;
START_PROFILE(syscall_openat);
+ SMB_ASSERT((dirfd != -1) || (smb_fname->base_name[0] == '/'));
+
if (how->resolve & ~(VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS |
VFS_OPEN_HOW_WITH_BACKUP_INTENT)) {
errno = ENOSYS;
.resolve = RESOLVE_NO_SYMLINKS,
};
- result = openat2(fsp_get_pathref_fd(dirfsp),
+ result = openat2(dirfd,
smb_fname->base_name,
&linux_how,
sizeof(linux_how));
became_root = true;
}
- result = openat(fsp_get_pathref_fd(dirfsp),
+ result = openat(dirfd,
smb_fname->base_name,
flags,
mode);