]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Ensure all returns from OpenDir() correctly set errno.
authorJeremy Allison <jra@samba.org>
Thu, 19 Aug 2021 22:43:52 +0000 (15:43 -0700)
committerNoel Power <npower@samba.org>
Fri, 20 Aug 2021 09:56:49 +0000 (09:56 +0000)
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

source3/smbd/dir.c

index 4c807c3f85cbabb3dc0ced4a3beaa9c1139b033e..174f07b11591b49468ae156082f4a779290d2b51 100644 (file)
@@ -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;
        }