[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-305-gca2c93b

Jeremy Allison jra at samba.org
Mon Sep 14 16:31:09 MDT 2009


The branch, master has been updated
       via  ca2c93b9e578fd9cd565f934b8910d6c738d787b (commit)
      from  f31138ecc778db42b1aa7ce634425a1df663b0eb (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ca2c93b9e578fd9cd565f934b8910d6c738d787b
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Sep 14 15:30:05 2009 -0700

    Fix bug 6494 - Incorrect FileStatus returned in NT_CREATE_ANDX.
    Lookup the EA and Stream status on CreateX.
    Jeremy.

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

Summary of changes:
 source3/include/smb.h  |    9 +++++++++
 source3/smbd/nttrans.c |   20 +++++++++++++++++++-
 source3/smbd/trans2.c  |   10 ++++++++--
 3 files changed, 36 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/smb.h b/source3/include/smb.h
index f8816b6..3c3ced6 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1511,6 +1511,15 @@ char *strdup(char *s);
 /* TCONX Flag (smb_vwv2). */
 #define TCONX_FLAG_EXTENDED_RESPONSE	0x8
 
+/* File Status Flags. See:
+
+http://msdn.microsoft.com/en-us/library/cc246334(PROT.13).aspx
+*/
+
+#define NO_EAS			0x1
+#define NO_SUBSTREAMS		0x2
+#define NO_REPARSETAG		0x4
+
 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
 
 #define CAP_RAW_MODE         0x0001
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 434bf34..1b98157 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -623,7 +623,25 @@ void reply_ntcreate_and_X(struct smb_request *req)
 	SOFF_T(p,0,file_len);
 	p += 8;
 	if (flags & EXTENDED_RESPONSE_REQUIRED) {
-		SSVAL(p,2,0x7);
+		uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
+		size_t num_names = 0;
+		unsigned int num_streams;
+		struct stream_struct *streams = NULL;
+
+		/* Do we have any EA's ? */
+		status = get_ea_names_from_file(ctx, conn, fsp,
+				smb_fname->base_name, NULL, &num_names);
+		if (NT_STATUS_IS_OK(status) && num_names) {
+			file_status &= ~NO_EAS;
+		}
+		status = SMB_VFS_STREAMINFO(conn, NULL, smb_fname->base_name, ctx,
+			&num_streams, &streams);
+		/* There is always one stream, ::$DATA. */
+		if (NT_STATUS_IS_OK(status) && num_streams > 1) {
+			file_status &= ~NO_SUBSTREAMS;
+		}
+		TALLOC_FREE(streams);
+		SSVAL(p,2,file_status);
 	}
 	p += 4;
 	SCVAL(p,0,fsp->is_directory ? 1 : 0);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 73873e0..f2c025b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -207,7 +207,9 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
 
 	if (sizeret == 0) {
 		TALLOC_FREE(names);
-		*pnames = NULL;
+		if (pnames) {
+			*pnames = NULL;
+		}
 		*pnum_names = 0;
 		return NT_STATUS_OK;
 	}
@@ -244,7 +246,11 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
 		names[num_names++] = p;
 	}
 
-	*pnames = names;
+	if (pnames) {
+		*pnames = names;
+	} else {
+		TALLOC_FREE(names);
+	}
 	*pnum_names = num_names;
 	return NT_STATUS_OK;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list