[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3479-gd5069c9

Jeremy Allison jra at samba.org
Thu Feb 19 19:59:42 GMT 2009


The branch, v3-2-test has been updated
       via  d5069c916a729698957dd5f828b1bad5bf17971e (commit)
       via  cdcb9bbf47396a7213edafeabb009920bb4e16b7 (commit)
      from  4bb5df5831f54686fe719f0cddef1af048009e9b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit d5069c916a729698957dd5f828b1bad5bf17971e
Merge: cdcb9bbf47396a7213edafeabb009920bb4e16b7 4bb5df5831f54686fe719f0cddef1af048009e9b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 19 11:58:43 2009 -0800

    Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test

commit cdcb9bbf47396a7213edafeabb009920bb4e16b7
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Feb 19 11:55:56 2009 -0800

    Backport the semantics of when to delete alternate data streams on a file truncate.
    Needed to fully support stream semantics.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/smbd/close.c |    2 +-
 source/smbd/open.c  |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/close.c b/source/smbd/close.c
index 7637ffb..9fd5693 100644
--- a/source/smbd/close.c
+++ b/source/smbd/close.c
@@ -167,7 +167,7 @@ static void notify_deferred_opens(struct share_mode_lock *lck)
  Delete all streams
 ****************************************************************************/
 
-static NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
+NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
 {
 	struct stream_struct *stream_info;
 	int i;
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 8209864..58d1f6d 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -1193,6 +1193,7 @@ static NTSTATUS open_file_ntcreate_internal(connection_struct *conn,
 	bool def_acl = False;
 	bool posix_open = False;
 	bool new_file_created = False;
+	bool clear_ads = false;
 	struct file_id id;
 	NTSTATUS fsp_open = NT_STATUS_ACCESS_DENIED;
 	mode_t new_unx_mode = (mode_t)0;
@@ -1325,12 +1326,14 @@ static NTSTATUS open_file_ntcreate_internal(connection_struct *conn,
 			/* If file exists replace/overwrite. If file doesn't
 			 * exist create. */
 			flags2 |= (O_CREAT | O_TRUNC);
+			clear_ads = true;
 			break;
 
 		case FILE_OVERWRITE_IF:
 			/* If file exists replace/overwrite. If file doesn't
 			 * exist create. */
 			flags2 |= (O_CREAT | O_TRUNC);
+			clear_ads = true;
 			break;
 
 		case FILE_OPEN:
@@ -1355,6 +1358,7 @@ static NTSTATUS open_file_ntcreate_internal(connection_struct *conn,
 				return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 			}
 			flags2 |= O_TRUNC;
+			clear_ads = true;
 			break;
 
 		case FILE_CREATE:
@@ -1787,6 +1791,16 @@ static NTSTATUS open_file_ntcreate_internal(connection_struct *conn,
 
 	SMB_ASSERT(lck != NULL);
 
+	/* Delete streams if create_disposition requires it */
+	if (file_existed && clear_ads && !is_ntfs_stream_name(fname)) {
+		status = delete_all_streams(conn, fname);
+		if (!NT_STATUS_IS_OK(status)) {
+			TALLOC_FREE(lck);
+			fd_close(fsp);
+			return status;
+		}
+	}
+
 	/* note that we ignore failure for the following. It is
            basically a hack for NFS, and NFS will never set one of
            these only read them. Nobody but Samba can ever set a deny


-- 
Samba Shared Repository


More information about the samba-cvs mailing list