[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Mon Apr 17 18:12:02 UTC 2023
The branch, master has been updated
via 526f381f413 shadow_copy2: Fix stream open for streams_depot paths
via 0327334c89c tests: Show that streams_depot and shadow_copy2 don't play together
via 081e808ab4a streams_depot: Create files when requested
from 45f026c45c9 debug: Only initialize gpfs wrapper when gpfs logging is enabled
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 526f381f413d1cb5cde93b9542034f5ebfcfcc10
Author: Volker Lendecke <vl at 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 <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Apr 17 18:11:07 UTC 2023 on atb-devel-224
commit 0327334c89cfda9020c6044a7b2b182138e46d03
Author: Volker Lendecke <vl at 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 <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 081e808ab4ac6e187b9791da322eb7173e1e133c
Author: Volker Lendecke <vl at 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 <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
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 717091cc8cf..6f9b7466e4a 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -3408,6 +3408,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
More information about the samba-cvs
mailing list