1 This patch is taken from community bug: |
|
2 https://bugzilla.samba.org/show_bug.cgi?id=12505 |
|
3 |
|
4 From 35493fe89b7674c9c05932146059fe253fee22bb Mon Sep 17 00:00:00 2001 |
|
5 From: Stefan Metzmacher <[email protected]> |
|
6 Date: Wed, 28 Oct 2015 12:16:05 +0100 |
|
7 Subject: [PATCH] s3:librpc: remove bigendian argument from |
|
8 dcerpc_pull_ncacn_packet() |
|
9 MIME-Version: 1.0 |
|
10 Content-Type: text/plain; charset=UTF-8 |
|
11 Content-Transfer-Encoding: 8bit |
|
12 |
|
13 We should get this from the packet itself. |
|
14 |
|
15 Signed-off-by: Stefan Metzmacher <[email protected]> |
|
16 Reviewed-by: Günther Deschner <[email protected]> |
|
17 Reviewed-by: Andreas Schneider <[email protected]> |
|
18 (cherry picked from commit 1bfba2c5161c0e27f8c27301f258360aedf1b018) |
|
19 --- |
|
20 source3/librpc/rpc/dcerpc.h | 3 +-- |
|
21 source3/librpc/rpc/dcerpc_helpers.c | 9 ++++----- |
|
22 source3/rpc_client/cli_pipe.c | 3 +-- |
|
23 3 files changed, 6 insertions(+), 9 deletions(-) |
|
24 |
|
25 diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h |
|
26 index 1838012..f58ef4c 100644 |
|
27 --- a/source3/librpc/rpc/dcerpc.h |
|
28 +++ b/source3/librpc/rpc/dcerpc.h |
|
29 @@ -61,8 +61,7 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx, |
|
30 DATA_BLOB *blob); |
|
31 NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx, |
|
32 const DATA_BLOB *blob, |
|
33 - struct ncacn_packet *r, |
|
34 - bool bigendian); |
|
35 + struct ncacn_packet *r); |
|
36 NTSTATUS dcerpc_push_dcerpc_auth(TALLOC_CTX *mem_ctx, |
|
37 enum dcerpc_AuthType auth_type, |
|
38 enum dcerpc_AuthLevel auth_level, |
|
39 diff --git a/source3/librpc/rpc/dcerpc_helpers.c b/source3/librpc/rpc/dcerpc_helpers.c |
|
40 index aab43a1..11b445f 100644 |
|
41 --- a/source3/librpc/rpc/dcerpc_helpers.c |
|
42 +++ b/source3/librpc/rpc/dcerpc_helpers.c |
|
43 @@ -88,14 +88,12 @@ NTSTATUS dcerpc_push_ncacn_packet(TALLOC_CTX *mem_ctx, |
|
44 * elements |
|
45 * @param blob The blob of data to decode |
|
46 * @param r An empty ncacn_packet, must not be NULL |
|
47 -* @param bigendian Whether the packet is bignedian encoded |
|
48 * |
|
49 * @return a NTSTATUS error code |
|
50 */ |
|
51 NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx, |
|
52 const DATA_BLOB *blob, |
|
53 - struct ncacn_packet *r, |
|
54 - bool bigendian) |
|
55 + struct ncacn_packet *r) |
|
56 { |
|
57 enum ndr_err_code ndr_err; |
|
58 struct ndr_pull *ndr; |
|
59 @@ -104,11 +102,12 @@ NTSTATUS dcerpc_pull_ncacn_packet(TALLOC_CTX *mem_ctx, |
|
60 if (!ndr) { |
|
61 return NT_STATUS_NO_MEMORY; |
|
62 } |
|
63 - if (bigendian) { |
|
64 + |
|
65 + if (!(CVAL(ndr->data, DCERPC_DREP_OFFSET) & DCERPC_DREP_LE)) { |
|
66 ndr->flags |= LIBNDR_FLAG_BIGENDIAN; |
|
67 } |
|
68 |
|
69 - if (CVAL(blob->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) { |
|
70 + if (CVAL(ndr->data, DCERPC_PFC_OFFSET) & DCERPC_PFC_FLAG_OBJECT_UUID) { |
|
71 ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT; |
|
72 } |
|
73 |
|
74 diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c |
|
75 index 97f4944..3b2eff5 100644 |
|
76 --- a/source3/rpc_client/cli_pipe.c |
|
77 +++ b/source3/rpc_client/cli_pipe.c |
|
78 @@ -948,8 +948,7 @@ static void rpc_api_pipe_got_pdu(struct tevent_req *subreq) |
|
79 |
|
80 status = dcerpc_pull_ncacn_packet(state->pkt, |
|
81 &state->incoming_frag, |
|
82 - state->pkt, |
|
83 - !state->endianess); |
|
84 + state->pkt); |
|
85 if (!NT_STATUS_IS_OK(status)) { |
|
86 /* |
|
87 * TODO: do a real async disconnect ... |
|
88 -- |
|
89 1.9.1 |
|
90 |
|