The branch, v4-18-test has been updated via 10ec0699aed shadow_copy2: Fix stream open for streams_depot paths via a377bd61102 tests: Show that streams_depot and shadow_copy2 don't play together via e1508b92203 streams_depot: Create files when requested from 64161923b6d rpcd_mdssvc: initialize POSIX locking
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-18-test - Log ----------------------------------------------------------------- commit 10ec0699aedd59e2ed957ecfeb96075ab9f66345 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 14 17:22:18 2023 +0200 shadow_copy2: Fix stream open for streams_depot paths streams_depot hands us absolute paths with : filename components instead of having set smb_fname_in->stream_name. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15358 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Apr 17 18:11:07 UTC 2023 on atb-devel-224 (cherry picked from commit 526f381f413d1cb5cde93b9542034f5ebfcfcc10) Autobuild-User(v4-18-test): Jule Anger <jan...@samba.org> Autobuild-Date(v4-18-test): Tue Apr 18 19:06:55 UTC 2023 on atb-devel-224 commit a377bd611023ad75046e697804126b78e923d62b Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 14 15:34:17 2023 +0000 tests: Show that streams_depot and shadow_copy2 don't play together See the next patch, we assert in shadow_copy2_openat() over paths passed in from shadow_copy2 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15358 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 0327334c89cfda9020c6044a7b2b182138e46d03) commit e1508b922032b08602544a363b9cb3ab690591d8 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 14 16:32:42 2023 +0200 streams_depot: Create files when requested If you set "create mask = 0600" no streams will be created.... Tested manually. Not creating an automated test for this, there are so many places where this can go wrong that testing this individual glitch does not gain us much confidence. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15357 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> (cherry picked from commit 081e808ab4ac6e187b9791da322eb7173e1e133c) ----------------------------------------------------------------------- Summary of changes: python/samba/tests/libsmb-basic.py | 15 ++++++++++++++- selftest/target/Samba3.pm | 5 +++++ source3/modules/vfs_shadow_copy2.c | 25 ++++++++++++++++--------- source3/modules/vfs_streams_depot.c | 2 +- 4 files changed, 36 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/python/samba/tests/libsmb-basic.py b/python/samba/tests/libsmb-basic.py index 37b82b26dac..cbe7cce5bae 100644 --- a/python/samba/tests/libsmb-basic.py +++ b/python/samba/tests/libsmb-basic.py @@ -19,7 +19,7 @@ from samba.samba3 import libsmb_samba_internal as libsmb from samba.dcerpc import security -from samba import NTSTATUSError +from samba import NTSTATUSError,ntstatus from samba.ntstatus import NT_STATUS_DELETE_PENDING from samba.credentials import SMB_ENCRYPTION_REQUIRED import samba.tests.libsmb @@ -202,6 +202,19 @@ class LibsmbTestCase(samba.tests.libsmb.LibsmbTests): c.rmdir("subdir") self.assertTrue(ret) + def test_libsmb_shadow_depot(self): + c = libsmb.Conn(self.server_ip, "shadow_depot", self.lp, self.creds) + try: + fnum=c.create("x:y",CreateDisposition=libsmb.FILE_CREATE) + c.close(fnum) + except: + self.fail() + finally: + # "c" might have crashed, get a new connection + c1 = libsmb.Conn(self.server_ip, "shadow_depot", self.lp, self.creds) + c1.unlink("x") + c1 = None + if __name__ == "__main__": import unittest unittest.main() diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index c8fe925a948..e0e3c026fa6 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -3405,6 +3405,11 @@ sub provision($$) shadow:fixinodes = yes smbd async dosmode = yes +[shadow_depot] + path = $shadow_shrdir + comment = previous versions with streams_depot + vfs objects = streams_depot shadow_copy2 + [dfq] path = $shrdir/dfree vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 16e39c2f070..a2c9d3ce4c9 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1522,15 +1522,22 @@ static struct smb_filename *shadow_copy2_openat_name( if (fsp->base_fsp != NULL) { struct smb_filename *base_fname = fsp->base_fsp->fsp_name; - SMB_ASSERT(is_named_stream(smb_fname_in)); - - result = synthetic_smb_fname( - mem_ctx, - base_fname->base_name, - smb_fname_in->stream_name, - &smb_fname_in->st, - smb_fname_in->twrp, - smb_fname_in->flags); + if (smb_fname_in->base_name[0] == '/') { + /* + * Special-case stream names from streams_depot + */ + result = cp_smb_filename(mem_ctx, smb_fname_in); + } else { + + SMB_ASSERT(is_named_stream(smb_fname_in)); + + result = synthetic_smb_fname(mem_ctx, + base_fname->base_name, + smb_fname_in->stream_name, + &smb_fname_in->st, + smb_fname_in->twrp, + smb_fname_in->flags); + } } else { result = full_path_from_dirfsp_atname( mem_ctx, dirfsp, smb_fname_in); diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index f92e9c8c5fa..83019fa07da 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -690,7 +690,7 @@ static int streams_depot_openat(struct vfs_handle_struct *handle, SMB_ASSERT(dirfsp == NULL); SMB_ASSERT(VALID_STAT(fsp->base_fsp->fsp_name->st)); - create_it = (how->mode & O_CREAT); + create_it = (how->flags & O_CREAT); /* Determine the stream name, and then open it. */ status = stream_smb_fname( -- Samba Shared Repository