s3: smbd: Fix smbd crash on dangling symlink with posix connection calling several...
authorJeremy Allison <jra@samba.org>
Tue, 15 Jun 2021 22:42:33 +0000 (15:42 -0700)
committerNoel Power <npower@samba.org>
Wed, 16 Jun 2021 11:58:00 +0000 (11:58 +0000)
Tidy up fsp == NULL checks. Remove knownfail.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14742

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): Wed Jun 16 11:58:00 UTC 2021 on sn-devel-184

selftest/knownfail.d/setpathsymlink [deleted file]
source3/smbd/trans2.c

diff --git a/selftest/knownfail.d/setpathsymlink b/selftest/knownfail.d/setpathsymlink
deleted file mode 100644 (file)
index 9d7ded3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba3.smbtorture_s3.crypt.POSIX-SYMLINK-SETPATHINFO.smbtorture\(nt4_dc_smb1\)
-^samba3.smbtorture_s3.plain.POSIX-SYMLINK-SETPATHINFO.smbtorture\(nt4_dc_smb1\)
index d6a1ea81ce0fddb9c8109a35df0134b327c7a1c3..23c13da4c581cfc355299c75847efa048a610ea7 100644 (file)
@@ -744,6 +744,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_fsp(fsp);
@@ -6862,7 +6866,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;
        }
 
@@ -7887,6 +7891,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;
@@ -7944,6 +7952,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 */