Found by the Apple client team. When we rename a file that is open multiple times in the client (i.e. more than one handle), we only preserve the stat info on the handle that is being renamed, not any of the other handles. If the client closes the handles without stat info using SMB2_CLOSE_FLAGS_FULL_INFORMATION then the openat_pathref_fsp() call to get the full information on close fails as in 4.16.x and 4.15.x openat_pathref_fsp() requires VALID_STAT(fsp->fsp_name->st) before opening the file. I have a regression test that demonstrates this problem. This doesn't fail on master as master has been changed to not require VALID_STAT(fsp->fsp_name->st) inside openat_pathref_fsp(), and successfully fstat's the handle before returning to setup_close_full_information(). The same fix (preserve stat info across handle renames) needs applying to the MSG_SMB_FILE_RENAME handler msg_file_was_renamed().
Created attachment 17253 [details] git-am fix for master. So I don't lose the original fix..
Oh, good catch! :)
Passes ci. MR for master is: https://gitlab.com/samba-team/samba/-/merge_requests/2466
This bug was referenced in samba master: e01c5992b061d8ed54645fff52a73418013340ab e862a2d9ec4e7bec1dd58490e9dee47d543b9154 4725ef5c96395dc2f48fab1160a3312d95e21416 1301e6461393601a4d43cfc465a05114e6ae4662 5e1aa469ae61af0442f432e0a2e3bf8c8709616a 06bfac2125da5e4d37a596d1213912f0c698e69e
Created attachment 17257 [details] git-am fix for 4.16.next, 4.15.next. Note, the patch for bug: https://bugzilla.samba.org/show_bug.cgi?id=15022 must be applied first in order for this to apply cleanly to 4.15.next, 4.16.next.
Reassigning to Jule for inclusion in 4.15 and 4.16.
Pushed to autobuild-v4-{16,15}-test.
This bug was referenced in samba v4-16-test: 552e0867848486629cc18bf52f7922768f41e1d5 60386712349f2a9f48f38fdc7c8dca8d4f635640 140670f6c05846f004ed70a3642780b3fa199bac 96a8922639d5ad9dc5005c5a1b1d747686a0d44f a68c572869dbf31104404dfef0949dabea77c4d3 414d890b65ef742acb736484525dd54039e09c18
This bug was referenced in samba v4-15-test: 23e3863b0705ca2bd277410e657b751c58fefca1 5e42298e69ac37172bd9d42c0d8943d0491ebd66 1b90b7b1aa3ceab546201868aed0ae7c419b2047 057babba5c2797e0e526b28b88f2f8b9fa5fb779 60802b1df92c1825460e04441ddd671516042e99 cc08531b0e524630eae6225cf1070e6ab6c66bad
Closing out bug report. Thanks!
This bug was referenced in samba v4-15-stable (Release samba-4.15.7): 23e3863b0705ca2bd277410e657b751c58fefca1 5e42298e69ac37172bd9d42c0d8943d0491ebd66 1b90b7b1aa3ceab546201868aed0ae7c419b2047 057babba5c2797e0e526b28b88f2f8b9fa5fb779 60802b1df92c1825460e04441ddd671516042e99 cc08531b0e524630eae6225cf1070e6ab6c66bad
This bug was referenced in samba v4-16-stable (Release samba-4.16.1): 552e0867848486629cc18bf52f7922768f41e1d5 60386712349f2a9f48f38fdc7c8dca8d4f635640 140670f6c05846f004ed70a3642780b3fa199bac 96a8922639d5ad9dc5005c5a1b1d747686a0d44f a68c572869dbf31104404dfef0949dabea77c4d3 414d890b65ef742acb736484525dd54039e09c18