1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s3: smbd: Ignore fstat() error on deleted stream in fd_close().

In the fd_close() fsp->fsp_flags.fstat_before_close code path.

If this is a stream and delete-on-close was set, the
backing object (an xattr from streams_xattr) might
already be deleted so fstat() fails with
NT_STATUS_NOT_FOUND. So if fsp refers to a stream we
ignore the error and only bail for normal files where
an fstat() should still work. NB. We cannot use
fsp_is_alternate_stream(fsp) for this as the base_fsp
has already been closed at this point and so the value
fsp_is_alternate_stream() checks for is already NULL.

Remove knownfail.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15487

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Oct 10 09:39:27 UTC 2023 on atb-devel-224
This commit is contained in:
Ralph Boehme 2023-09-20 14:21:44 -07:00 committed by Volker Lendecke
parent 23deb79a28
commit 633a3ee689
2 changed files with 14 additions and 2 deletions

View File

@ -1 +0,0 @@
^samba.tests.libsmb-basic.samba.tests.libsmb-basic.LibsmbTestCase.test_stream_close_with_full_information

View File

@ -997,7 +997,20 @@ NTSTATUS fd_close(files_struct *fsp)
if (fsp->fsp_flags.fstat_before_close) {
status = vfs_stat_fsp(fsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
/*
* If this is a stream and delete-on-close was set, the
* backing object (an xattr from streams_xattr) might
* already be deleted so fstat() fails with
* NT_STATUS_NOT_FOUND. So if fsp refers to a stream we
* ignore the error and only bail for normal files where
* an fstat() should still work. NB. We cannot use
* fsp_is_alternate_stream(fsp) for this as the base_fsp
* has already been closed at this point and so the value
* fsp_is_alternate_stream() checks for is already NULL.
*/
if (fsp->fsp_name->stream_name == NULL) {
return status;
}
}
}