[SCM] Samba Shared Repository - branch v4-15-test updated

Jule Anger janger at samba.org
Thu Jun 23 09:50:01 UTC 2022


The branch, v4-15-test has been updated
       via  86e9958156c s3: VFS: streams_xattr: Add the same accommodation to streams_xattr_unlinkat() as used in streams_xattr_renameat().
       via  31d9de1405c s3: tests: Add test that shows smbd crashes using vfs_fruit with fruit:resource = stream on deleting a file.
      from  c7b633f3172 s3/client: fix dfs deltree, resolve dfs path

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test


- Log -----------------------------------------------------------------
commit 86e9958156cc1df69bf8bafa8e28df7ce39a0982
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 17 17:51:35 2022 -0700

    s3: VFS: streams_xattr: Add the same accommodation to streams_xattr_unlinkat() as used in streams_xattr_renameat().
    
    vfs_fruit passes a synthetic filename here where smb_fname->fsp==NULL
    when configured to use "fruit:resource = stream" so we need to use
    synthetic_pathref() to get an fsp on the smb_fname->base_name
    in order to call SMB_VFS_FREMOVEXATTR().
    
    This is the same change we already use in streams_xattr_renameat()
    and streams_xattr_stat(), the other pathname operations we implement
    here.
    
    Remove knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15099
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Mon Jun 20 14:24:20 UTC 2022 on sn-devel-184
    
    (backported from commit 808a7b8b76dbcaac1db0508fd410d0bcf702af7a)
    
    Autobuild-User(v4-15-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-15-test): Thu Jun 23 09:49:14 UTC 2022 on sn-devel-184

commit 31d9de1405c8483187070492f479f4ed40e94651
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 17 17:49:43 2022 -0700

    s3: tests: Add test that shows smbd crashes using vfs_fruit with fruit:resource = stream on deleting a file.
    
    Add knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15099
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    (backported from commit 238b2cbb8f352375c448d86b462f13752640e16b)

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm                          |  9 +++++
 source3/modules/vfs_streams_xattr.c                | 24 +++++++++++--
 source3/script/tests/test_fruit_resource_stream.sh | 41 ++++++++++++++++++++++
 source3/selftest/tests.py                          |  4 +++
 4 files changed, 75 insertions(+), 3 deletions(-)
 create mode 100755 source3/script/tests/test_fruit_resource_stream.sh


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index e578791a2ee..43bce06c6d9 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2422,6 +2422,9 @@ sub provision($$)
 	my $local_symlinks_shrdir="$shrdir/local_symlinks";
 	push(@dirs,$local_symlinks_shrdir);
 
+	my $fruit_resource_stream_shrdir="$shrdir/fruit_resource_stream";
+	push(@dirs,$fruit_resource_stream_shrdir);
+
 	# this gets autocreated by winbindd
 	my $wbsockdir="$prefix_abs/wbsock";
 
@@ -2982,6 +2985,12 @@ sub provision($$)
 	fruit:metadata = stream
 	fruit:zero_file_id=yes
 
+[fruit_resource_stream]
+	path = $fruit_resource_stream_shrdir
+	vfs objects = fruit streams_xattr acl_xattr xattr_tdb
+	fruit:resource = stream
+	fruit:metadata = stream
+
 [badname-tmp]
 	path = $badnames_shrdir
 	guest ok = yes
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 558bf228794..aa6ed82e472 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -481,6 +481,8 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
 	NTSTATUS status;
 	int ret = -1;
 	char *xattr_name = NULL;
+	struct smb_filename *pathref = NULL;
+	struct files_struct *fsp = smb_fname->fsp;
 
 	if (!is_named_stream(smb_fname)) {
 		return SMB_VFS_NEXT_UNLINKAT(handle,
@@ -496,10 +498,25 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
 		goto fail;
 	}
 
-	SMB_ASSERT(smb_fname->fsp != NULL);
-	SMB_ASSERT(smb_fname->fsp->base_fsp != NULL);
+	if (fsp == NULL) {
+		status = synthetic_pathref(talloc_tos(),
+					handle->conn->cwd_fsp,
+					smb_fname->base_name,
+					NULL,
+					NULL,
+					smb_fname->twrp,
+					smb_fname->flags,
+					&pathref);
+		if (!NT_STATUS_IS_OK(status)) {
+			errno = ENOENT;
+			goto fail;
+		}
+		fsp = pathref->fsp;
+	} else {
+		fsp = fsp->base_fsp;
+	}
 
-	ret = SMB_VFS_FREMOVEXATTR(smb_fname->fsp->base_fsp, xattr_name);
+	ret = SMB_VFS_FREMOVEXATTR(fsp, xattr_name);
 
 	if ((ret == -1) && (errno == ENOATTR)) {
 		errno = ENOENT;
@@ -510,6 +527,7 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
 
  fail:
 	TALLOC_FREE(xattr_name);
+	TALLOC_FREE(pathref);
 	return ret;
 }
 
diff --git a/source3/script/tests/test_fruit_resource_stream.sh b/source3/script/tests/test_fruit_resource_stream.sh
new file mode 100755
index 00000000000..7e99ea3de5c
--- /dev/null
+++ b/source3/script/tests/test_fruit_resource_stream.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# this tests copying a file and then deleting it
+# to a share using fruit:resource = stream
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=15099
+
+if [ $# -lt 6 ]; then
+	cat <<EOF
+Usage: $0 SERVER SHARE USERNAME PASSWORD LOCAL_PATH SMBCLIENT
+EOF
+	exit 1
+fi
+
+SERVER="${1}"
+SHARE="${2}"
+USERNAME="${3}"
+PASSWORD="${4}"
+LOCAL_PATH="${5}"
+SMBCLIENT="${6}"
+SMBCLIENT="$VALGRIND ${SMBCLIENT}"
+
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+. "$incdir/subunit.sh"
+
+failed=0
+
+put_then_delete_file()
+{
+	$SMBCLIENT //"$SERVER"/"$SHARE" -U"$USERNAME"%"$PASSWORD" -c "lcd $LOCAL_PATH; put src dst; rm dst" >/dev/null 2>&1
+}
+
+rm -f "$LOCAL_PATH/src"
+rm -f "$LOCAL_PATH/dst"
+touch "$LOCAL_PATH/src"
+
+testit "resource_stream" put_then_delete_file || failed=$((failed + 1))
+
+rm -f "$LOCAL_PATH/src"
+rm -f "$LOCAL_PATH/dst"
+
+testok "$0" "$failed"
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index d7ee1ab6200..376e356ba3d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -657,6 +657,10 @@ for env in ["fileserver"]:
     plantestsuite("samba3.blackbox.fifo", env,
                   [os.path.join(samba3srcdir, "script/tests/test_fifo.sh"),
                   '$SERVER', '$DOMAIN', 'gooduser', '$PASSWORD', '$PREFIX', env, smbclient3])
+    plantestsuite("samba3.blackbox.fruit.resource_stream", env,
+                  [os.path.join(samba3srcdir, "script/tests/test_fruit_resource_stream.sh"),
+                  '$SERVER', 'fruit_resource_stream', '$USERNAME', '$PASSWORD',
+                  '$LOCAL_PATH/fruit_resource_stream', smbclient3])
 
 for env in ["fileserver:local"]:
     plantestsuite("samba3.blackbox.net_usershare", env, [os.path.join(samba3srcdir, "script/tests/test_net_usershare.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3])


-- 
Samba Shared Repository



More information about the samba-cvs mailing list