The Samba-Bugzilla – Attachment 12595 Details for
Bug 12384
streams_depot leaves lost-XXXXX files on file deletion.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.5.next
bug-12384 (text/plain), 5.62 KB, created by
Jeremy Allison
on 2016-10-21 19:09:06 UTC
(
hide
)
Description:
git-am fix for 4.5.next
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2016-10-21 19:09:06 UTC
Size:
5.62 KB
patch
obsolete
>From 98c7228aad2c038eb9d544194562efde1b3025a6 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 20 Oct 2016 13:33:09 -0700 >Subject: [PATCH 1/3] s3: torture: vfstest. unlink cmd must be stream aware. > >Otherwise the following patch breaks vfstest stream-depot test. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12384 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Uri Simchoni <uri@samba.org> >(cherry picked from commit 4e93ea2340b7589769d55085aaa71070a2d7e416) >--- > source3/torture/cmd_vfs.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > >diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c >index 12610cf..b57a061 100644 >--- a/source3/torture/cmd_vfs.c >+++ b/source3/torture/cmd_vfs.c >@@ -442,6 +442,14 @@ static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg > ret = SMB_VFS_RMDIR(vfs->conn, smb_fname); > TALLOC_FREE(smb_fname); > } else if (strcmp("unlink", argv[0]) == 0 ) { >+ TALLOC_FREE(smb_fname); >+ /* unlink can be a stream:name */ >+ smb_fname = synthetic_smb_fname_split(talloc_tos(), >+ argv[1], >+ lp_posix_pathnames()); >+ if (smb_fname == NULL) { >+ return NT_STATUS_NO_MEMORY; >+ } > ret = SMB_VFS_UNLINK(vfs->conn, smb_fname); > TALLOC_FREE(smb_fname); > } else if (strcmp("chdir", argv[0]) == 0 ) { >-- >2.8.0.rc3.226.g39d4020 > > >From 83caab95b5e90837b5d6bba1301751a6a7d5ac00 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 19 Oct 2016 11:56:49 -0700 >Subject: [PATCH 2/3] s3: vfs: Remove files/directories after the streams are > deleted. > >By the time we get to SMB_VFS_UNLINK/SMB_VFS_RMDIR the ACL >checks have already been done. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12384 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Uri Simchoni <uri@samba.org> >(cherry picked from commit b17c9fdc51c10313eed32d6e078ed7050a342d0f) >--- > source3/modules/vfs_streams_depot.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > >diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c >index 83c9d97..d874514 100644 >--- a/source3/modules/vfs_streams_depot.c >+++ b/source3/modules/vfs_streams_depot.c >@@ -725,8 +725,12 @@ static int streams_depot_unlink(vfs_handle_struct *handle, > return -1; > } > >- ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname); >- if (ret == 0) { >+ /* >+ * We know the unlink should succeed as the ACL >+ * check is already done in the caller. Remove the >+ * file *after* the streams. >+ */ >+ { > char *dirname = stream_dir(handle, smb_fname_base, > &smb_fname_base->st, false); > >@@ -749,6 +753,7 @@ static int streams_depot_unlink(vfs_handle_struct *handle, > TALLOC_FREE(dirname); > } > >+ ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname); > TALLOC_FREE(smb_fname_base); > return ret; > } >@@ -787,8 +792,12 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, > return -1; > } > >- ret = SMB_VFS_NEXT_RMDIR(handle, smb_fname_base); >- if (ret == 0) { >+ /* >+ * We know the rmdir should succeed as the ACL >+ * check is already done in the caller. Remove the >+ * directory *after* the streams. >+ */ >+ { > char *dirname = stream_dir(handle, smb_fname_base, > &smb_fname_base->st, false); > >@@ -811,6 +820,7 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, > TALLOC_FREE(dirname); > } > >+ ret = SMB_VFS_NEXT_RMDIR(handle, smb_fname_base); > TALLOC_FREE(smb_fname_base); > return ret; > } >-- >2.8.0.rc3.226.g39d4020 > > >From 0a1eecfea7e31cd3c1127d038ddc553da572f622 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 19 Oct 2016 16:33:52 -0700 >Subject: [PATCH 3/3] s3: selftest: Add test for orphan 'lost-XXX' directories > in streams_depot. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12384 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Uri Simchoni <uri@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Fri Oct 21 04:48:52 CEST 2016 on sn-devel-144 > >(cherry picked from commit ad60b8cc48b1095ce97170eed3d09fca7181a3bc) >--- > source3/script/tests/test_smbclient_s3.sh | 41 +++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > >diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh >index 5e3db5d..22849bd 100755 >--- a/source3/script/tests/test_smbclient_s3.sh >+++ b/source3/script/tests/test_smbclient_s3.sh >@@ -1060,6 +1060,43 @@ EOF > fi > } > >+# Test creating then deleting a stream file doesn't leave a lost-XXXXX directory. >+test_streams_depot_delete() >+{ >+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands >+ rm -rf "$LOCAL_PATH/lost-*" >+ >+ cat > $tmpfile <<EOF >+put ${PREFIX}/smbclient_interactive_prompt_commands foo:bar >+del foo >+ls lost* >+quit >+EOF >+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP -mSMB3 $ADDARGS < $tmpfile 2>&1' >+ eval echo "$cmd" >+ out=`eval $cmd` >+ ret=$? >+ rm -f $tmpfile >+ >+ if [ $ret != 0 ] ; then >+ echo "$out" >+ echo "failed creating then deleting foo:bar with error $ret" >+ false >+ return >+ fi >+ >+ echo "$out" | grep 'NT_STATUS_NO_SUCH_FILE listing \\lost\*' >+ ret=$? >+ if [ $ret != 0 ] ; then >+ echo "$out" >+ echo "deleting foo:bar left lost-XXX directory" >+ rm -rf "$LOCAL_PATH/lost-*" >+ false >+ return >+ fi >+} >+ >+ > LOGDIR_PREFIX=test_smbclient_s3 > > # possibly remove old logdirs: >@@ -1155,6 +1192,10 @@ testit "Ensure widelinks are restricted" \ > test_widelinks || \ > failed=`expr $failed + 1` > >+testit "streams_depot can delete correctly" \ >+ test_streams_depot_delete || \ >+ failed=`expr $failed + 1` >+ > testit "rm -rf $LOGDIR" \ > rm -rf $LOGDIR || \ > failed=`expr $failed + 1` >-- >2.8.0.rc3.226.g39d4020 >
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
Flags:
uri
:
review+
Actions:
View
Attachments on
bug 12384
: 12595