Skip to content

Fix bug 15038 - SMB2_CLOSE_FLAGS_FULL_INFORMATION fails to return information on renamed file handle.

A rename request on a handle currently zeros out the fsp->fsp_name->st structure on all handles open on a file (including ones in other smbds open on the same files). This is because rename_open_files() calls fsp_set_smb_fname() with a synthesised smb_fname containing an INVALID_STAT to rename the file. On the handle being renamed this doesn't always hurt as we usually re-stat the fsp just after the rename. For other handles and ones being changed via a MSG_SMB_FILE_RENAME message this doesn't get done, leaving the fsp stat as INVALID.

Fix this by preserving the existing fsp->fsp_name->st across the rename. Adds a regression test (which accidentally passes on master due to a previous change which allows openat_pathref_fsp() to open an smb_fname without an existing valid STAT struct, but fails on 4.15 and 4.16) and then fixes it. We need the test to ensure we don't regress here anyway.

Passes ci. Assigning to Ralph as he's already aware of this one.

Merge request reports