25511645 smbclient fails to list shares from Solaris 11 SPARC kernel SMB server
authorJiri Sasek <Jiri.Sasek@Oracle.COM>
Thu, 16 Feb 2017 06:53:10 -0800
changeset 7675 a1504c073861
parent 7674 e5be4a3b0c32
child 7680 09661509b866
25511645 smbclient fails to list shares from Solaris 11 SPARC kernel SMB server
components/samba/patches/25511645.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/samba/patches/25511645.patch	Thu Feb 16 06:53:10 2017 -0800
@@ -0,0 +1,90 @@
+This patch is taken from community bug:
+https://bugzilla.samba.org/show_bug.cgi?id=12505
+
+From 35493fe89b7674c9c05932146059fe253fee22bb Mon Sep 17 00:00:00 2001
+From: Stefan Metzmacher <[email protected]>
+Date: Wed, 28 Oct 2015 12:16:05 +0100
+Subject: [PATCH] s3:librpc: remove bigendian argument from
+ dcerpc_pull_ncacn_packet()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We should get this from the packet itself.
+
+Signed-off-by: Stefan Metzmacher <[email protected]>
+Reviewed-by: G√ľnther Deschner <[email protected]>
+Reviewed-by: Andreas Schneider <[email protected]>
+(cherry picked from commit 1bfba2c5161c0e27f8c27301f258360aedf1b018)
+---
+ source3/librpc/rpc/dcerpc.h         | 3 +--
+ source3/librpc/rpc/dcerpc_helpers.c | 9 ++++-----
+ source3/rpc_client/cli_pipe.c       | 3 +--
+ 3 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
+index 1838012..f58ef4c 100644
+--- a/source3/librpc/rpc/dcerpc.h
++++ b/source3/librpc/rpc/dcerpc.h
[email protected]@ -61,8 +61,7 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+ 				  DATA_BLOB *blob);
+ NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+ 				  const DATA_BLOB *blob,
+-				  struct ncacn_packet *r,
+-				  bool bigendian);
++				  struct ncacn_packet *r);
+ NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx,
+ 				 enum dcerpc_AuthType auth_type,
+ 				 enum dcerpc_AuthLevel auth_level,
+diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c
+index aab43a1..11b445f 100644
+--- a/source3/librpc/rpc/dcerpc_helpers.c
++++ b/source3/librpc/rpc/dcerpc_helpers.c
[email protected]@ -88,14 +88,12 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx,
+ *			elements
+ * @param blob		The blob of data to decode
+ * @param r		An empty ncacn_packet, must not be NULL
+-* @param bigendian	Whether the packet is bignedian encoded
+ *
+ * @return a NTSTATUS error code
+ */
+ NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+ 				  const DATA_BLOB *blob,
+-				  struct ncacn_packet *r,
+-				  bool bigendian)
++				  struct ncacn_packet *r)
+ {
+ 	enum ndr_err_code ndr_err;
+ 	struct ndr_pull *ndr;
[email protected]@ -104,11 +102,12 @@ NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx,
+ 	if (!ndr) {
+ 		return NT_STATUS_NO_MEMORY;
+ 	}
+-	if (bigendian) {
++
++	if (!(CVAL(ndr->data, DCERPC_DREP_OFFSET) & DCERPC_DREP_LE)) {
+ 		ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ 	}
+ 
+-	if (CVAL(blob->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) {
++	if (CVAL(ndr->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) {
+ 		ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
+ 	}
+ 
+diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
+index 97f4944..3b2eff5 100644
+--- a/source3/rpc_client/cli_pipe.c
++++ b/source3/rpc_client/cli_pipe.c
[email protected]@ -948,8 +948,7 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq)
+ 
+ 	status = dcerpc_pull_ncacn_packet(state->pkt,
+ 					  &state->incoming_frag,
+-					  state->pkt,
+-					  !state->endianess);
++					  state->pkt);
+ 	if (!NT_STATUS_IS_OK(status)) {
+ 		/*
+ 		 * TODO: do a real async disconnect ...
+-- 
+1.9.1
+