summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-08-19 15:43:52 -0700
committerJule Anger <janger@samba.org>2021-08-25 13:01:09 +0000
commit34d2bc284607ada608948bfccc7686fb14cb9c39 (patch)
tree348a91e8e0feb2f797389151ef0c46d112f5cf6e /source3
parentccd0b8655741966930d3193900b4fa3e97cc8b1b (diff)
downloadsamba-34d2bc284607ada608948bfccc7686fb14cb9c39.tar.gz
s3: smbd: Ensure all returns from OpenDir() correctly set errno.
Complex code paths inside open_internal_dirfsp() can return an NTSTATUS, but trample on the matching errno. We need to make sure if open_internal_dirfsp() fails, errno matches the NTSTATUS return. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14805 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Fri Aug 20 09:56:49 UTC 2021 on sn-devel-184 (cherry picked from commit 72b4fe93f15e414ca3e7d7f0e77a5f0aae90556a)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 4c807c3f85c..174f07b1159 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1474,6 +1474,8 @@ struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx,
O_RDONLY,
&fsp);
if (!NT_STATUS_IS_OK(status)) {
+ /* Ensure we return the actual error from status in errno. */
+ errno = map_errno_from_nt_status(status);
return NULL;
}