[SCM] Samba Shared Repository - branch v4-1-test updated

Karolin Seeger kseeger at samba.org
Wed Aug 7 06:57:03 MDT 2013


The branch, v4-1-test has been updated
       via  099fd4c Ensure gpfs kernel leases are wrapped in a become_root()/unbecome_root() pair.
       via  224ea46 Wrap setting leases in become_root()/unbecome_root() to ensure correct delivery of signals.
       via  cd0f88d Add torture tests to raw.eas to check sending Windows invalid names in the middle of an EA list.
       via  7f52ae9 Reply with correct trans2 message on a setpathinfo with a bad EA name.
       via  e413edd Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
       via  12d06fb Ensure we can't create a file using NTTRANS with an invalid EA list.
       via  b22b1bc Ensure we can't create a file using TRANS2_OPEN with an invalid EA list.
       via  2b165a1 Add error map of STATUS_INVALID_EA_NAME -> ERRDOS, ERRbadfile
       via  65d4a4c 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  d3b9f6c Ensure we can't create a file using SMB2_CREATE with an invalid EA list.
       via  dc2320a Ensure we never return an EA name to a Windows client it can't handle.
       via  36bca02 Ensure set_ea cannot set invalid Windows EA names.
       via  a6df18d Add ea_list_has_invalid_name() function.
      from  4bf25ec nsswitch: Add OPT_KRB5CCNAME to avoid an error message.

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


- Log -----------------------------------------------------------------
commit 099fd4c85e151bd7f9ec45fbea7365625de1ac3f
Author: Ralph Wuerthner <ralphw at de.ibm.com>
Date:   Wed Jul 31 16:33:48 2013 -0700

    Ensure gpfs kernel leases are wrapped in a become_root()/unbecome_root() pair.
    
    Ensures correct lease owner for signal delivery.
    
    Signed-off-by: Ralph Wuerthner <ralphw at de.ibm.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Simo Sorce <idra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Aug  1 03:57:11 CEST 2013 on sn-devel-104
    
    The last 2 patches address bug #10064 - Linux kernel oplock breaks can miss
    signals.
    
    Autobuild-User(v4-1-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-1-test): Wed Aug  7 14:56:04 CEST 2013 on sn-devel-104

commit 224ea469aa324161495b7727dc3f49d848bb9836
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jul 31 16:32:20 2013 -0700

    Wrap setting leases in become_root()/unbecome_root() to ensure correct delivery of signals.
    
    Remove workaround for Linux kernel bug https://bugzilla.kernel.org/show_bug.cgi?id=43336
    as we don't need to set capabilities when we're already root.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Simo Sorce <idra at samba.org>

commit cd0f88d6188fb14817c6fbcf7ba80b58ccd6365f
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>

commit 7f52ae982617026a0d09571baa98fdff7c4d6dda
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>

commit e413edd57d1911b24dbc767eac4d27fe8358f77e
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>

commit 12d06fb3c631f19bee122a2c5edf214000a2e01f
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>

commit b22b1bc0fcf4977ac2ebd2a26a44856b1351e975
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>

commit 2b165a12ed488579f4e845f4fc8183edfbe4e396
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>

commit 65d4a4cefdd75c4067edec92fd464e9b17a3900a
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>

commit d3b9f6c0f8e1bfc70c59e846fd10f976ec371a35
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>

commit dc2320a29828b1787e49c3ec5609b36e08433328
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>

commit 36bca0236ded85f6565678f8ac711796c82b652d
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>

commit a6df18d47bdb1d99ebadf1754adc8669fd156836
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>

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

Summary of changes:
 libcli/util/errormap.c      |    1 +
 selftest/knownfail          |    1 +
 source3/include/proto.h     |    2 +
 source3/lib/filename_util.c |   34 +++++++++++++
 source3/modules/vfs_gpfs.c  |    6 ++
 source3/smbd/blocking.c     |    2 +-
 source3/smbd/nttrans.c      |   86 ++++++++++++++++++++------------
 source3/smbd/oplock_linux.c |   33 ++++++++-----
 source3/smbd/proto.h        |    1 +
 source3/smbd/smb2_create.c  |    5 ++
 source3/smbd/trans2.c       |   86 +++++++++++++++++++++++++++-----
 source4/torture/raw/eas.c   |  114 +++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 310 insertions(+), 61 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 3943e60..0c501fa 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/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 13061c8..4a53bf8 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -111,7 +111,13 @@ static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp,
 	START_PROFILE(syscall_linux_setlease);
 
 	if (config->leases) {
+		/*
+		 * Ensure the lease owner is root to allow
+		 * correct delivery of lease-break signals.
+		 */
+		become_root();
 		ret = set_gpfs_lease(fsp->fh->fd,leasetype);
+		unbecome_root();
 	}
 
 	END_PROFILE(syscall_linux_setlease);
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 0d74a58..f4b0456 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1098,6 +1098,43 @@ 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,
+				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)
@@ -1148,43 +1185,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,
-				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/oplock_linux.c b/source3/smbd/oplock_linux.c
index 7fa9b7c..dd772bf 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -75,26 +75,33 @@ int linux_set_lease_sighandler(int fd)
 int linux_setlease(int fd, int leasetype)
 {
 	int ret;
+	int saved_errno;
+
+	/*
+	 * Ensure the lease owner is root to allow
+	 * correct delivery of lease-break signals.
+	 */
+
+	become_root();
 
 	/* First set the signal handler. */
 	if (linux_set_lease_sighandler(fd) == -1) {
-		return -1;
+		saved_errno = errno;
+		ret = -1;
+		goto out;
 	}
 	ret = fcntl(fd, F_SETLEASE, leasetype);
-	if (ret == -1 && errno == EACCES) {
-		set_effective_capability(LEASE_CAPABILITY);
-		/*
-		 * Bug 8974 - work around Linux kernel bug
-		 * https://bugzilla.kernel.org/show_bug.cgi?id=43336.
-		 * "fcntl(F_SETLEASE) resets signal number when
-		 *  called multiple times"
-		 */
-		if (linux_set_lease_sighandler(fd) == -1) {
-			return -1;
-		}
-		ret = fcntl(fd, F_SETLEASE, leasetype);
+	if (ret == -1) {
+		saved_errno = errno;
 	}
 
+  out:
+
+	unbecome_root();
+
+	if (ret == -1) {
+		errno = saved_errno;
+	}
 	return ret;
 }
 
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 6a43d27..168beac 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);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list