[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Mon Oct 1 10:48:04 MDT 2012
The branch, master has been updated
via 8da8a22 s3: vfs_streams_depot: add delete_lost option
via 7a76762 s3: make recursive_rmdir function non-static
from 07b918a s3: Fix bug 8966, Fix net rpc share allowedusers to work with 2008r2
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8da8a2289ea51d4fcdf6b5352a46c14d36d8f072
Author: Björn Baumbach <bb at sernet.de>
Date: Thu Sep 27 12:40:47 2012 +0200
s3: vfs_streams_depot: add delete_lost option
With this option lost stream directories will be removed
instead of renamed.
Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Mon Oct 1 18:47:30 CEST 2012 on sn-devel-104
commit 7a76762c688f4fc7519dbd204b036963c460e093
Author: Björn Baumbach <bb at sernet.de>
Date: Mon Oct 1 09:55:28 2012 +0200
s3: make recursive_rmdir function non-static
-----------------------------------------------------------------------
Summary of changes:
source3/modules/vfs_streams_depot.c | 65 ++++++++++++++++++++++------------
source3/smbd/close.c | 8 ++--
source3/smbd/proto.h | 3 ++
3 files changed, 49 insertions(+), 27 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index c0d5945..620a580 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -198,6 +198,7 @@ static char *stream_dir(vfs_handle_struct *handle,
if (SMB_VFS_NEXT_STAT(handle, smb_fname_hash) == 0) {
struct smb_filename *smb_fname_new = NULL;
char *newname;
+ bool delete_lost;
if (!S_ISDIR(smb_fname_hash->st.st_ex_mode)) {
errno = EINVAL;
@@ -211,36 +212,54 @@ static char *stream_dir(vfs_handle_struct *handle,
/*
* Someone has recreated a file under an existing inode
- * without deleting the streams directory. For now, just move
- * it away.
+ * without deleting the streams directory.
+ * Move it away or remove if streams_depot:delete_lost is set.
*/
again:
- newname = talloc_asprintf(talloc_tos(), "lost-%lu", random());
- if (newname == NULL) {
- errno = ENOMEM;
- goto fail;
- }
+ delete_lost = lp_parm_bool(SNUM(handle->conn), "streams_depot",
+ "delete_lost", false);
+
+ if (delete_lost) {
+ DEBUG(3, ("Someone has recreated a file under an "
+ "existing inode. Removing: %s\n",
+ smb_fname_hash->base_name));
+ recursive_rmdir(talloc_tos(), handle->conn,
+ smb_fname_hash);
+ SMB_VFS_NEXT_RMDIR(handle, smb_fname_hash->base_name);
+ } else {
+ newname = talloc_asprintf(talloc_tos(), "lost-%lu",
+ random());
+ DEBUG(3, ("Someone has recreated a file under an "
+ "existing inode. Renaming: %s to: %s\n",
+ smb_fname_hash->base_name,
+ newname));
+ if (newname == NULL) {
+ errno = ENOMEM;
+ goto fail;
+ }
- status = create_synthetic_smb_fname(talloc_tos(), newname,
- NULL, NULL,
- &smb_fname_new);
- TALLOC_FREE(newname);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- goto fail;
- }
+ status = create_synthetic_smb_fname(talloc_tos(),
+ newname,
+ NULL, NULL,
+ &smb_fname_new);
+ TALLOC_FREE(newname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ goto fail;
+ }
- if (SMB_VFS_NEXT_RENAME(handle, smb_fname_hash,
- smb_fname_new) == -1) {
- TALLOC_FREE(smb_fname_new);
- if ((errno == EEXIST) || (errno == ENOTEMPTY)) {
- goto again;
+ if (SMB_VFS_NEXT_RENAME(handle, smb_fname_hash,
+ smb_fname_new) == -1) {
+ TALLOC_FREE(smb_fname_new);
+ if ((errno == EEXIST) || (errno == ENOTEMPTY)) {
+ goto again;
+ }
+ goto fail;
}
- goto fail;
- }
- TALLOC_FREE(smb_fname_new);
+ TALLOC_FREE(smb_fname_new);
+ }
}
if (!create_it) {
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 8bf481d..9b988e0 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -853,13 +853,13 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
return status;
}
/****************************************************************************
- Static function used by reply_rmdir to delete an entire directory
+ Function used by reply_rmdir to delete an entire directory
tree recursively. Return True on ok, False on fail.
****************************************************************************/
-static bool recursive_rmdir(TALLOC_CTX *ctx,
- connection_struct *conn,
- struct smb_filename *smb_dname)
+bool recursive_rmdir(TALLOC_CTX *ctx,
+ connection_struct *conn,
+ struct smb_filename *smb_dname)
{
const char *dname = NULL;
char *talloced = NULL;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index a1cef16..143da49 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -139,6 +139,9 @@ void msg_close_file(struct messaging_context *msg_ctx,
struct server_id server_id,
DATA_BLOB *data);
NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
+bool recursive_rmdir(TALLOC_CTX *ctx,
+ connection_struct *conn,
+ struct smb_filename *smb_dname);
/* The following definitions come from smbd/conn.c */
--
Samba Shared Repository
More information about the samba-cvs
mailing list