From 456bee958b78c7dca042de2acd76407224f4aff4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 19 Oct 2016 11:56:49 -0700 Subject: [PATCH] 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. Signed-off-by: Jeremy Allison --- 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