The Samba-Bugzilla – Attachment 17371 Details for
Bug 15099
Using vfs_streams_xattr and deleting a file causes a panic.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for master.
bug-15099-master.patch (text/plain), 6.74 KB, created by
Jeremy Allison
on 2022-06-18 01:00:39 UTC
(
hide
)
Description:
git-am fix for master.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2022-06-18 01:00:39 UTC
Size:
6.74 KB
patch
obsolete
>From 7c39934d4d728f668decc6d57b881a77b2353337 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 17 Jun 2022 17:49:43 -0700 >Subject: [PATCH 1/2] 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@samba.org> >--- > selftest/knownfail.d/fruit_resource_stream | 1 + > selftest/target/Samba3.pm | 9 ++++ > .../tests/test_fruit_resource_stream.sh | 41 +++++++++++++++++++ > source3/selftest/tests.py | 4 ++ > 4 files changed, 55 insertions(+) > create mode 100644 selftest/knownfail.d/fruit_resource_stream > create mode 100755 source3/script/tests/test_fruit_resource_stream.sh > >diff --git a/selftest/knownfail.d/fruit_resource_stream b/selftest/knownfail.d/fruit_resource_stream >new file mode 100644 >index 00000000000..081edb983ee >--- /dev/null >+++ b/selftest/knownfail.d/fruit_resource_stream >@@ -0,0 +1 @@ >+^samba3.blackbox.fruit.resource_stream.resource_stream\(fileserver\) >diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm >index 798796bc21f..db8c55602da 100755 >--- a/selftest/target/Samba3.pm >+++ b/selftest/target/Samba3.pm >@@ -2567,6 +2567,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"; > >@@ -3127,6 +3130,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/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 2e62696cb82..c53be8b471b 100755 >--- a/source3/selftest/tests.py >+++ b/source3/selftest/tests.py >@@ -676,6 +676,10 @@ for env in ["fileserver"]: > plantestsuite("samba3.blackbox.test_full_audit_fail_badname", env, > [os.path.join(samba3srcdir, "script/tests/test_bad_auditnames.sh"), > '$SERVER', 'full_audit_fail_bad_name', '$USERNAME', '$PASSWORD', 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]) >-- >2.34.1 > > >From 15f144a6c1eb081212e5dfa235056d7f37dec425 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Fri, 17 Jun 2022 17:51:35 -0700 >Subject: [PATCH 2/2] 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@samba.org> >--- > selftest/knownfail.d/fruit_resource_stream | 1 - > source3/modules/vfs_streams_xattr.c | 25 +++++++++++++++++++--- > 2 files changed, 22 insertions(+), 4 deletions(-) > delete mode 100644 selftest/knownfail.d/fruit_resource_stream > >diff --git a/selftest/knownfail.d/fruit_resource_stream b/selftest/knownfail.d/fruit_resource_stream >deleted file mode 100644 >index 081edb983ee..00000000000 >--- a/selftest/knownfail.d/fruit_resource_stream >+++ /dev/null >@@ -1 +0,0 @@ >-^samba3.blackbox.fruit.resource_stream.resource_stream\(fileserver\) >diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c >index 324490354b0..3e39770bb37 100644 >--- a/source3/modules/vfs_streams_xattr.c >+++ b/source3/modules/vfs_streams_xattr.c >@@ -479,6 +479,8 @@ static int streams_xattr_unlinkat(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, >@@ -497,10 +499,26 @@ static int streams_xattr_unlinkat(vfs_handle_struct *handle, > goto fail; > } > >- SMB_ASSERT(smb_fname->fsp != NULL); >- SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp)); >+ 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 { >+ SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp)); >+ 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; >@@ -511,6 +529,7 @@ static int streams_xattr_unlinkat(vfs_handle_struct *handle, > > fail: > TALLOC_FREE(xattr_name); >+ TALLOC_FREE(pathref); > return ret; > } > >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 15099
:
17362
|
17363
|
17366
| 17371 |
17374
|
17375