[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Fri Jul 19 03:51:02 MDT 2013


The branch, master has been updated
       via  bb21fc5 Add torture tests to raw.eas to check sending Windows invalid names in the middle of an EA list.
       via  5d54ac4 Reply with correct trans2 message on a setpathinfo with a bad EA name.
       via  b50b006 Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
       via  4a43600 Ensure we can't create a file using NTTRANS with an invalid EA list.
       via  66fb5ee Ensure we can't create a file using TRANS2_OPEN with an invalid EA list.
       via  fe542fc Add error map of STATUS_INVALID_EA_NAME -> ERRDOS, ERRbadfile
       via  50a288c Add the ability to send an NTSTATUS result back with a trans2 reply so we can return a parameter block with an error code.
       via  21c9296 Ensure we can't create a file using SMB2_CREATE with an invalid EA list.
       via  66e7b15 Ensure we never return an EA name to a Windows client it can't handle.
       via  f246d69 Ensure set_ea cannot set invalid Windows EA names.
       via  1766f9e Add ea_list_has_invalid_name() function.
      from  51c68c2 librpc: srvsvc.idl: define level 1005 share info flags

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


- Log -----------------------------------------------------------------
commit bb21fc51e42c830d7fab4e89d83f8ef4d122fa1a
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 16:37:48 2013 -0700

    Add torture tests to raw.eas to check sending Windows invalid names in the middle of an EA list.
    
    Add torture tests to probe the set of invalid
    Windows EA names.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Fri Jul 19 11:50:25 CEST 2013 on sn-devel-104

commit 5d54ac414f2130fcbd434b7c96e1efe4a22cc1ff
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 09:14:12 2013 -0700

    Reply with correct trans2 message on a setpathinfo with a bad EA name.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b50b006ace92bb0781173b1244e84ae7bf64732f
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 16 11:05:10 2013 -0700

    Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4a4360070589a314667166f86c395878659123e1
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 15:54:39 2013 -0700

    Ensure we can't create a file using NTTRANS with an invalid EA list.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 66fb5eeb968e12049381337d7c01401815537a34
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 15:59:53 2013 -0700

    Ensure we can't create a file using TRANS2_OPEN with an invalid EA list.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fe542fc170053a370092fcf442075dc44189f23e
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 10 12:18:36 2013 -0700

    Add error map of STATUS_INVALID_EA_NAME -> ERRDOS, ERRbadfile
    
    (from Windows2012 tests).
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 50a288cb6a9bfff1d16cf488bbc0eedcb6ad4602
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 10 12:38:41 2013 -0700

    Add the ability to send an NTSTATUS result back with a trans2 reply so we can return a parameter block with an error code.
    
    This is needed when returning a STATUS_INVALID_NAME result (tested
    from Windows 2012).
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 21c92969b8d0ad7a77028d24c5b3fea63264e473
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 16:02:50 2013 -0700

    Ensure we can't create a file using SMB2_CREATE with an invalid EA list.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 66e7b15982f188e8b1886eaacf850a7c623733d8
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 16:21:18 2013 -0700

    Ensure we never return an EA name to a Windows client it can't handle.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit f246d69b9e38db8632ade65692078959e3ed4da8
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 15:52:47 2013 -0700

    Ensure set_ea cannot set invalid Windows EA names.
    
    Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1766f9e3878a8ee64104a7a1c0874a7a0c6a2417
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 9 15:50:47 2013 -0700

    Add ea_list_has_invalid_name() function.
    
    Invalid character list probed from Windows Server 2012.
    
    Bug 9992: Windows error 0x800700FE when copying files with xattr names containing ":"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 libcli/util/errormap.c      |    1 +
 selftest/knownfail          |    1 +
 source3/include/proto.h     |    2 +
 source3/lib/filename_util.c |   34 +++++++++++++
 source3/smbd/blocking.c     |    2 +-
 source3/smbd/nttrans.c      |   88 ++++++++++++++++++++-------------
 source3/smbd/proto.h        |    1 +
 source3/smbd/smb2_create.c  |    5 ++
 source3/smbd/trans2.c       |   86 +++++++++++++++++++++++++++-----
 source4/torture/raw/eas.c   |  114 +++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 285 insertions(+), 49 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/errormap.c b/libcli/util/errormap.c
index 714e62c..3870619 100644
--- a/libcli/util/errormap.c
+++ b/libcli/util/errormap.c
@@ -54,6 +54,7 @@ static const struct {
  */
 	{ERRDOS,	ERRmoredata,	STATUS_BUFFER_OVERFLOW},
 	{ERRDOS,	ERRnofiles,	STATUS_NO_MORE_FILES},
+	{ERRDOS,	ERRbadfile,	STATUS_INVALID_EA_NAME},
 	{ERRDOS,	ERRnofiles,	NT_STATUS_NO_MORE_ENTRIES},
 	{ERRDOS,	ERRgeneral,	NT_STATUS_UNSUCCESSFUL},
 	{ERRDOS,	ERRbadfunc,	NT_STATUS_NOT_IMPLEMENTED},
diff --git a/selftest/knownfail b/selftest/knownfail
index 313d6c9..4fe96f3 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -81,6 +81,7 @@
 ^samba4.raw.session.expire1
 ^samba4.raw.rename.*.osxrename
 ^samba4.raw.rename.*.directory rename
+^samba4.raw.eas
 ^samba4.rpc.winreg.*security
 ^samba4.local.registry.(dir|ldb).check hive security
 ^samba4.local.registry.local.security
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 83ab77a..a9270fc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1611,6 +1611,8 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
 				     const struct smb_filename *in);
 bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
 bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
+bool is_invalid_windows_ea_name(const char *name);
+bool ea_list_has_invalid_name(struct ea_list *ea_list);
 
 /* The following definitions come from lib/dummyroot.c */
 
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index 656dd2a..19ffcc3 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -224,3 +224,37 @@ bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname)
 
 	return strcasecmp_m(smb_fname->stream_name, "::$DATA") == 0;
 }
+
+/****************************************************************************
+ Filter out Windows invalid EA names (list probed from Windows 2012).
+****************************************************************************/
+
+static char bad_ea_name_chars[] = "\"*+,/:;<=>?[\\]|";
+
+bool is_invalid_windows_ea_name(const char *name)
+{
+	int i;
+	/* EA name is pulled as ascii so we can examine
+	   individual bytes here. */
+	for (i = 0; name[i] != 0; i++) {
+		int val = (name[i] & 0xff);
+		if (val < ' ' || strchr(bad_ea_name_chars, val)) {
+			return true;
+		}
+	}
+	return false;
+}
+
+bool ea_list_has_invalid_name(struct ea_list *ea_list)
+{
+	if (lp_posix_pathnames()) {
+		return false;
+	}
+
+	for (;ea_list; ea_list = ea_list->next) {
+		if (is_invalid_windows_ea_name(ea_list->ea.name)) {
+			return true;
+		}
+	}
+	return false;
+}
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 4bd7a57..5f6dda3 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -563,7 +563,7 @@ static bool process_trans2(struct blocking_lock_record *blr)
 
 	SSVAL(params,0,0);
 	/* Fake up max_data_bytes here - we know it fits. */
-	send_trans2_replies(blr->fsp->conn, blr->req, params, 2, NULL, 0, 0xffff);
+	send_trans2_replies(blr->fsp->conn, blr->req, NT_STATUS_OK, params, 2, NULL, 0, 0xffff);
 	return True;
 }
 
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 516b826..c8116b0 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1092,6 +1092,44 @@ static void call_nt_transact_create(connection_struct *conn,
 	 */
 	create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
 
+	srvstr_get_path(ctx, params, req->flags2, &fname,
+			params+53, parameter_count-53,
+			STR_TERMINATE, &status);
+	if (!NT_STATUS_IS_OK(status)) {
+		reply_nterror(req, status);
+		goto out;
+	}
+
+	if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
+		case_state = set_posix_case_semantics(ctx, conn);
+		if (!case_state) {
+			reply_nterror(req, NT_STATUS_NO_MEMORY);
+			goto out;
+		}
+	}
+
+	status = filename_convert(ctx,
+				conn,
+				req->flags2 & FLAGS2_DFS_PATHNAMES,
+				fname,
+				(create_disposition == FILE_CREATE)
+				  ? UCF_CREATING_FILE : 0,
+				NULL,
+				&smb_fname);
+
+	TALLOC_FREE(case_state);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
+			reply_botherror(req,
+				NT_STATUS_PATH_NOT_COVERED,
+				ERRSRV, ERRbadpath);
+			goto out;
+		}
+		reply_nterror(req, status);
+		goto out;
+	}
+
 	/* Ensure the data_len is correct for the sd and ea values given. */
 	if ((ea_len + sd_len > data_count)
 	    || (ea_len > data_count) || (sd_len > data_count)
@@ -1142,44 +1180,26 @@ static void call_nt_transact_create(connection_struct *conn,
 			reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
 			goto out;
 		}
-	}
-
-	srvstr_get_path(ctx, params, req->flags2, &fname,
-			params+53, parameter_count-53,
-			STR_TERMINATE, &status);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		goto out;
-	}
-
-	if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) {
-		case_state = set_posix_case_semantics(ctx, conn);
-		if (!case_state) {
-			reply_nterror(req, NT_STATUS_NO_MEMORY);
-			goto out;
-		}
-	}
-
-	status = filename_convert(ctx,
-				conn,
-				req->flags2 & FLAGS2_DFS_PATHNAMES,
-				fname,
-				(create_disposition == FILE_CREATE)
-				  ? UCF_CREATING_FILE : 0,
-				NULL,
-				&smb_fname);
 
-	TALLOC_FREE(case_state);
+		if (ea_list_has_invalid_name(ea_list)) {
+			/* Realloc the size of parameters and data we will return */
+			if (flags & EXTENDED_RESPONSE_REQUIRED) {
+				/* Extended response is 32 more byyes. */
+				param_len = 101;
+			} else {
+				param_len = 69;
+			}
+			params = nttrans_realloc(ppparams, param_len);
+			if(params == NULL) {
+				reply_nterror(req, NT_STATUS_NO_MEMORY);
+				goto out;
+			}
 
-	if (!NT_STATUS_IS_OK(status)) {
-		if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-			reply_botherror(req,
-				NT_STATUS_PATH_NOT_COVERED,
-				ERRSRV, ERRbadpath);
+			memset(params, '\0', param_len);
+			send_nt_replies(conn, req, STATUS_INVALID_EA_NAME,
+				params, param_len, NULL, 0);
 			goto out;
 		}
-		reply_nterror(req, status);
-		goto out;
 	}
 
 	oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 38707d5..9c76609 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1071,6 +1071,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
 void send_trans2_replies(connection_struct *conn,
 			struct smb_request *req,
+			NTSTATUS status,
 			 const char *params,
 			 int paramsize,
 			 const char *pdata,
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index ba743e7..4f2edfc 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -584,6 +584,11 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 				tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
 				return tevent_req_post(req, ev);
 			}
+
+			if (ea_list_has_invalid_name(ea_list)) {
+				tevent_req_nterror(req, STATUS_INVALID_EA_NAME);
+				return tevent_req_post(req, ev);
+			}
 		}
 
 		if (mxac) {
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 14a2e0f..a216f15 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -345,6 +345,15 @@ static NTSTATUS get_ea_list_from_file_path(TALLOC_CTX *mem_ctx, connection_struc
 		    || samba_private_attr_name(names[i]))
 			continue;
 
+		/*
+		 * Filter out any underlying POSIX EA names
+		 * that a Windows client can't handle.
+		 */
+		if (!lp_posix_pathnames() &&
+				is_invalid_windows_ea_name(names[i])) {
+			continue;
+		}
+
 		listp = talloc(mem_ctx, struct ea_list);
 		if (listp == NULL) {
 			return NT_STATUS_NO_MEMORY;
@@ -623,6 +632,15 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
+	/*
+	 * Filter out invalid Windows EA names - before
+	 * we set *any* of them.
+	 */
+
+	if (ea_list_has_invalid_name(ea_list)) {
+		return STATUS_INVALID_EA_NAME;
+	}
+
 	fname = smb_fname->base_name;
 
 	for (;ea_list; ea_list = ea_list->next) {
@@ -878,6 +896,7 @@ static struct ea_list *ea_list_union(struct ea_list *name_list, struct ea_list *
 
 void send_trans2_replies(connection_struct *conn,
 			struct smb_request *req,
+			NTSTATUS status,
 			 const char *params,
 			 int paramsize,
 			 const char *pdata,
@@ -918,6 +937,14 @@ void send_trans2_replies(connection_struct *conn,
 
 	if(params_to_send == 0 && data_to_send == 0) {
 		reply_outbuf(req, 10, 0);
+		if (NT_STATUS_V(status)) {
+			uint8_t eclass;
+			uint32_t ecode;
+			ntstatus_to_dos(status, &eclass, &ecode);
+			error_packet_set((char *)req->outbuf,
+					eclass, ecode, status,
+					__LINE__,__FILE__);
+		}
 		show_msg((char *)req->outbuf);
 		if (!srv_send_smb(sconn,
 				(char *)req->outbuf,
@@ -1048,6 +1075,13 @@ void send_trans2_replies(connection_struct *conn,
 					 ERRDOS,ERRbufferoverflow,
 					 STATUS_BUFFER_OVERFLOW,
 					 __LINE__,__FILE__);
+		} else if (NT_STATUS_V(status)) {
+			uint8_t eclass;
+			uint32_t ecode;
+			ntstatus_to_dos(status, &eclass, &ecode);
+			error_packet_set((char *)req->outbuf,
+					eclass, ecode, status,
+					__LINE__,__FILE__);
 		}
 
 		/* Send the packet */
@@ -1219,6 +1253,20 @@ static void call_trans2open(connection_struct *conn,
 			reply_nterror(req, NT_STATUS_EAS_NOT_SUPPORTED);
 			goto out;
 		}
+
+		if (ea_list_has_invalid_name(ea_list)) {
+			int param_len = 30;
+			*pparams = (char *)SMB_REALLOC(*pparams, param_len);
+			if(*pparams == NULL ) {
+				reply_nterror(req, NT_STATUS_NO_MEMORY);
+				goto out;
+			}
+			params = *pparams;
+			memset(params, '\0', param_len);
+			send_trans2_replies(conn, req, STATUS_INVALID_EA_NAME,
+				params, param_len, NULL, 0, max_data_bytes);
+			goto out;
+		}
 	}
 
 	status = SMB_VFS_CREATE_FILE(
@@ -1294,7 +1342,7 @@ static void call_trans2open(connection_struct *conn,
 	}
 
 	/* Send the required number of replies */
-	send_trans2_replies(conn, req, params, 30, *ppdata, 0, max_data_bytes);
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 30, *ppdata, 0, max_data_bytes);
  out:
 	TALLOC_FREE(smb_fname);
 }
@@ -2658,7 +2706,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
 	SSVAL(params,6,0); /* Never an EA error */
 	SSVAL(params,8,last_entry_off);
 
-	send_trans2_replies(conn, req, params, 10, pdata, PTR_DIFF(p,pdata),
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 10, pdata, PTR_DIFF(p,pdata),
 			    max_data_bytes);
 
 	if ((! *directory) && dptr_path(sconn, dptr_num)) {
@@ -3009,7 +3057,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
 	SSVAL(params,4,0); /* Never an EA error */
 	SSVAL(params,6,last_entry_off);
 
-	send_trans2_replies(conn, req, params, 8, pdata, PTR_DIFF(p,pdata),
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 8, pdata, PTR_DIFF(p,pdata),
 			    max_data_bytes);
 
 	return;
@@ -3653,7 +3701,7 @@ static void call_trans2qfsinfo(connection_struct *conn,
 		return;
 	}
 
-	send_trans2_replies(conn, req, params, 0, *ppdata, data_len,
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 0, *ppdata, data_len,
 			    max_data_bytes);
 
 	DEBUG( 4, ( "%s info_level = %d\n",
@@ -3809,6 +3857,7 @@ static void call_trans2setfsinfo(connection_struct *conn,
 				}
 
 				send_trans2_replies(conn, req,
+						NT_STATUS_OK,
 						*pparams,
 						param_len,
 						*ppdata,
@@ -4341,7 +4390,7 @@ static void call_trans2qpipeinfo(connection_struct *conn,
 			return;
 	}
 
-	send_trans2_replies(conn, req, params, param_size, *ppdata, data_size,
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, param_size, *ppdata, data_size,
 			    max_data_bytes);
 
 	return;
@@ -5543,7 +5592,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
 		return;
 	}
 
-	send_trans2_replies(conn, req, params, param_size, *ppdata, data_size,
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, param_size, *ppdata, data_size,
 			    max_data_bytes);
 
 	return;
@@ -8106,7 +8155,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
 					 fsp_str_dbg(fsp)));
 
 				SSVAL(params,0,0);
-				send_trans2_replies(conn, req, params, 2,
+				send_trans2_replies(conn, req, NT_STATUS_OK, params, 2,
 						    *ppdata, 0,
 						    max_data_bytes);
 				return;
@@ -8229,11 +8278,20 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
 			return;
 		}
 
-		reply_nterror(req, status);
+		/*
+		 * Invalid EA name needs to return 2 param bytes,
+		 * not a zero-length error packet.
+		 */
+		if (NT_STATUS_EQUAL(status, STATUS_INVALID_EA_NAME)) {
+			send_trans2_replies(conn, req, status, params, 2, NULL, 0,
+					max_data_bytes);
+		} else {
+			reply_nterror(req, status);
+		}
 		return;
 	}
 
-	send_trans2_replies(conn, req, params, 2, *ppdata, data_return_size,
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 2, *ppdata, data_return_size,
 			    max_data_bytes);
 
 	return;
@@ -8358,7 +8416,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
 
 	SSVAL(params,0,0);
 
-	send_trans2_replies(conn, req, params, 2, *ppdata, 0, max_data_bytes);
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 2, *ppdata, 0, max_data_bytes);
 
  out:
 	TALLOC_FREE(smb_dname);
@@ -8413,7 +8471,7 @@ static void call_trans2findnotifyfirst(connection_struct *conn,
 	if(fnf_handle == 0)
 		fnf_handle = 257;
 
-	send_trans2_replies(conn, req, params, 6, *ppdata, 0, max_data_bytes);
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 6, *ppdata, 0, max_data_bytes);
 
 	return;
 }
@@ -8444,7 +8502,7 @@ static void call_trans2findnotifynext(connection_struct *conn,
 	SSVAL(params,0,0); /* No changes */
 	SSVAL(params,2,0); /* No EA errors */
 
-	send_trans2_replies(conn, req, params, 4, *ppdata, 0, max_data_bytes);
+	send_trans2_replies(conn, req, NT_STATUS_OK, params, 4, *ppdata, 0, max_data_bytes);
 
 	return;
 }
@@ -8494,7 +8552,7 @@ static void call_trans2getdfsreferral(connection_struct *conn,
 
 	SSVAL((discard_const_p(uint8_t, req->inbuf)), smb_flg2,
 	      SVAL(req->inbuf,smb_flg2) | FLAGS2_DFS_PATHNAMES);
-	send_trans2_replies(conn, req,0,0,*ppdata,reply_size, max_data_bytes);
+	send_trans2_replies(conn, req, NT_STATUS_OK, 0,0,*ppdata,reply_size, max_data_bytes);
 
 	return;
 }
@@ -8543,7 +8601,7 @@ static void call_trans2ioctl(connection_struct *conn,
 		srvstr_push(pdata, req->flags2, pdata+18,
 			    lp_servicename(talloc_tos(), SNUM(conn)), 13,
 			    STR_ASCII|STR_TERMINATE); /* Service name */
-		send_trans2_replies(conn, req, *pparams, 0, *ppdata, 32,
+		send_trans2_replies(conn, req, NT_STATUS_OK, *pparams, 0, *ppdata, 32,
 				    max_data_bytes);
 		return;
 	}
diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c
index a0ba06f..95a55d1 100644
--- a/source4/torture/raw/eas.c
+++ b/source4/torture/raw/eas.c
@@ -42,6 +42,8 @@ static bool check_ea(struct smbcli_state *cli,
 	return NT_STATUS_IS_OK(status);
 }
 
+static char bad_ea_chars[] = "\"*+,/:;<=>?[\\]|";
+
 static bool test_eas(struct smbcli_state *cli, struct torture_context *tctx)
 {
 	NTSTATUS status;
@@ -49,6 +51,8 @@ static bool test_eas(struct smbcli_state *cli, struct torture_context *tctx)
 	union smb_open io;
 	const char *fname = BASEDIR "\\ea.txt";
 	bool ret = true;
+	char bad_ea_name[6];
+	int i;
 	int fnum = -1;
 
 	torture_comment(tctx, "TESTING SETFILEINFO EA_SET\n");
@@ -131,6 +135,59 @@ static bool test_eas(struct smbcli_state *cli, struct torture_context *tctx)
 	ret &= check_ea(cli, fname, "EAONE", NULL);
 	ret &= check_ea(cli, fname, "SECONDEA", NULL);
 
+	/* Check EA name containing colon. All EA's set
+	   must be ignored, not just the one with the bad
+	   name. */
+
+	torture_comment(tctx, "Adding bad EA name\n");
+	setfile.generic.level = RAW_SFILEINFO_EA_SET;
+	setfile.generic.in.file.fnum = fnum;
+	setfile.ea_set.in.num_eas = 3;
+	setfile.ea_set.in.eas = talloc_array(tctx, struct ea_struct, 3);
+	setfile.ea_set.in.eas[0].flags = 0;
+	setfile.ea_set.in.eas[0].name.s = "EAONE";


-- 
Samba Shared Repository


More information about the samba-cvs mailing list