The branch, v3-6-test has been updated via 693533b s3: Add rmdir operation to streams_depot via 9ba7748 s3: Delete streams on directories from 15a423b s3:smbd:smb2: fix an assignment-instead-of-check bug conn_snum_used()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 693533ba5b91d74925568f719bdee969c6637ba7 Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 31 22:26:35 2012 +0100 s3: Add rmdir operation to streams_depot The last 2 patches address bug #8733 (streams_depot leaves streams around on rmdir). commit 9ba7748b5f1c08dbefbb8d9c9646f631c2a355e0 Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 31 22:26:23 2012 +0100 s3: Delete streams on directories ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_streams_depot.c | 47 +++++++++++++++++++++++++++++++++++ source3/smbd/close.c | 11 ++++++++ 2 files changed, 58 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 708a90b..ba426a3 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -657,6 +657,52 @@ static int streams_depot_unlink(vfs_handle_struct *handle, return ret; } +static int streams_depot_rmdir(vfs_handle_struct *handle, const char *path) +{ + struct smb_filename *smb_fname_base = NULL; + NTSTATUS status; + int ret = -1; + + DEBUG(10, ("streams_depot_rmdir called for %s\n", path)); + + /* + * We potentially need to delete the per-inode streams directory + */ + + status = create_synthetic_smb_fname(talloc_tos(), path, + NULL, NULL, &smb_fname_base); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return -1; + } + + if (lp_posix_pathnames()) { + ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_base); + } else { + ret = SMB_VFS_NEXT_STAT(handle, smb_fname_base); + } + + if (ret == -1) { + TALLOC_FREE(smb_fname_base); + return -1; + } + + if (smb_fname_base->st.st_ex_nlink == 2) { + char *dirname = stream_dir(handle, smb_fname_base, + &smb_fname_base->st, false); + + if (dirname != NULL) { + SMB_VFS_NEXT_RMDIR(handle, dirname); + } + TALLOC_FREE(dirname); + } + + ret = SMB_VFS_NEXT_RMDIR(handle, path); + + TALLOC_FREE(smb_fname_base); + return ret; +} + static int streams_depot_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) @@ -868,6 +914,7 @@ static struct vfs_fn_pointers vfs_streams_depot_fns = { .stat = streams_depot_stat, .lstat = streams_depot_lstat, .unlink = streams_depot_unlink, + .rmdir = streams_depot_rmdir, .rename = streams_depot_rename, .streaminfo = streams_depot_streaminfo, }; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 25c8b46..a431a5d 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1042,6 +1042,17 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, TALLOC_FREE(lck); + if ((fsp->conn->fs_capabilities & FILE_NAMED_STREAMS) + && !is_ntfs_stream_smb_fname(fsp->fsp_name)) { + + status = delete_all_streams(fsp->conn, fsp->fsp_name->base_name); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(5, ("delete_all_streams failed: %s\n", + nt_errstr(status))); + goto out; + } + } + status = rmdir_internals(talloc_tos(), fsp); DEBUG(5,("close_directory: %s. Delete on close was set - " -- Samba Shared Repository