From 832d612ab5404a8a421989c9b85d937df12caec1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 15 Jun 2021 15:42:33 -0700 Subject: [PATCH] s3: smbd: Fix smbd crash on dangling symlink with posix connection calling several non-posix info levels. Tidy up fsp == NULL checks. Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14742 Signed-off-by: Jeremy Allison Reviewed-by: Noel Power Autobuild-User(master): Noel Power Autobuild-Date(master): Wed Jun 16 11:58:00 UTC 2021 on sn-devel-184 (cherry picked from commit 263c95aee38c9198ad9a30c4d960d72f46b7c27a) --- source3/smbd/trans2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index fac45df586e..70a492a96a8 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -785,6 +785,10 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, return NT_STATUS_EAS_NOT_SUPPORTED; } + if (fsp == NULL) { + return NT_STATUS_INVALID_HANDLE; + } + posix_pathnames = (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH); status = refuse_symlink(conn, fsp, fsp->fsp_name); @@ -6860,7 +6864,7 @@ static NTSTATUS smb_set_file_full_ea_info(connection_struct *conn, struct ea_list *ea_list = NULL; NTSTATUS status; - if (!fsp) { + if (fsp == NULL) { return NT_STATUS_INVALID_HANDLE; } @@ -7899,6 +7903,10 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } + if (fsp == NULL) { + return NT_STATUS_INVALID_HANDLE; + } + status = check_access_fsp(fsp, FILE_WRITE_ATTRIBUTES); if (!NT_STATUS_IS_OK(status)) { return status; @@ -7956,6 +7964,10 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } + if (fsp == NULL) { + return NT_STATUS_INVALID_HANDLE; + } + /* create time */ ft.create_time = time_t_to_full_timespec(srv_make_unix_date2(pdata)); /* access time */ -- 2.30.2