The branch, master has been updated via 1f328d1 s3: Add rmdir operation to streams_depot via 92b96ac s3: Delete streams on directories via a93cdac s3: Simplify an if-statement from a1901b5 Fix bug #8729 - getpass regressions on Solaris/Illumos - 3.6 and master.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1f328d1e6a820564e9570bc27a018301c7cb453c Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 31 22:26:35 2012 +0100 s3: Add rmdir operation to streams_depot Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Wed Feb 1 01:05:57 CET 2012 on sn-devel-104 commit 92b96ac84bea5aa8ca37ea6ca17376199aef4142 Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 31 22:26:23 2012 +0100 s3: Delete streams on directories commit a93cdacd1679d968862b6c82ea266f986d4c621e Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 31 17:47:07 2012 +0100 s3: Simplify an if-statement is_ntfs_default_stream_smb_fname already contains all checks that the variable "stream_name" gives us here. ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_streams_depot.c | 47 +++++++++++++++++++++++++++++++++++ source3/smbd/close.c | 11 ++++++++ source3/smbd/open.c | 2 +- 3 files changed, 59 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 68a1453..a188274 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_fn = streams_depot_stat, .lstat_fn = streams_depot_lstat, .unlink_fn = streams_depot_unlink, + .rmdir_fn = streams_depot_rmdir, .rename_fn = streams_depot_rename, .streaminfo_fn = streams_depot_streaminfo, }; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 131f4bf..42e88d8 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1088,6 +1088,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 - " diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 3374fdb..a94a02e 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3832,7 +3832,7 @@ NTSTATUS create_file_default(connection_struct *conn, } } - if (stream_name && is_ntfs_default_stream_smb_fname(smb_fname)) { + if (is_ntfs_default_stream_smb_fname(smb_fname)) { int ret; smb_fname->stream_name = NULL; /* We have to handle this error here. */ -- Samba Shared Repository