If openat_pathref_fsp() fails, callers might want to inspect the stat
info. If we really failed on STOPPED_ON_SYMLINK, the caller might need
to know this, although openat_pathref_fsp() masked this error.
As there is no smb_fname->fsp returned from openat_pathref_fsp() on
error, we need to pass this up in smb_fname itself.
This essentially reverts
de439cd03047, which does basically the same
thing but is too specific. We need to cover the general !O_PATH case
more broadly.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
status = fd_openat(dirfsp, smb_fname, fsp, open_flags, 0);
if (!NT_STATUS_IS_OK(status)) {
+
+ smb_fname->st = fsp->fsp_name->st;
+
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND) ||
NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND) ||
NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK))
strerror(errno));
goto out;
}
+ orig_fsp_name->st = fsp->fsp_name->st;
}
if (fd != -1) {
saved_status = status;
if (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) {
- /* Never follow symlinks on posix open, .. but
- * pass the fact it's a symlink in
- * smb_fname->st
- */
- smb_fname->st = fsp->fsp_name->st;
+ /* Never follow symlinks on posix open. */
goto out;
}
if (!lp_follow_symlinks(SNUM(conn))) {