summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-16 09:02:58 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-16 09:02:58 +0000
commit24c22aef90d8534ee2d016b37b2b302f1367d106 (patch)
treececb9192f1a83f7232041cda58e83e1d94ac57b5 /source4/librpc/rpc/dcerpc_util.c
parent1413faae582949e7d12174df7102723eea914464 (diff)
downloadsamba-24c22aef90d8534ee2d016b37b2b302f1367d106.tar.gz
samba-24c22aef90d8534ee2d016b37b2b302f1367d106.tar.bz2
samba-24c22aef90d8534ee2d016b37b2b302f1367d106.zip
a fairly large commit!
This adds support for bigendian rpc in the client. I have installed SUN pcnetlink locally and am using it to test the samba4 rpc code. This allows us to easily find places where we have stuffed up the types (such as 2 uint16 versus a uint32), as testing both big-endian and little-endian easily shows which is correct. I have now used this to fix several bugs like that in the samba4 IDL. In order to make this work I also had to redefine a GUID as a true structure, not a blob. From the pcnetlink wire it is clear that it is indeed defined as a structure (the byte order changes). This required changing lots of Samba code to use a GUID as a structure. I also had to fix the if_version code in dcerpc syntax IDs, as it turns out they are a single uint32 not two uint16s. The big-endian support is a bit ugly at the moment, and breaks the layering in some places. More work is needed, especially on the server side. (This used to be commit bb1af644a5a7b188290ce36232f255da0e5d66d2)
Diffstat (limited to 'source4/librpc/rpc/dcerpc_util.c')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 02e224a26f..fbc97f316d 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -59,7 +59,7 @@ NTSTATUS dcerpc_epm_map_tcp_port(const char *server,
NTSTATUS status;
struct epm_Map r;
struct policy_handle handle;
- GUID guid;
+ struct GUID guid;
struct epm_twr_t twr, *twr_r;
if (strcasecmp(uuid, DCERPC_EPMAPPER_UUID) == 0 ||
@@ -223,7 +223,8 @@ const struct dcerpc_interface_table *idl_iface_by_uuid(const char *uuid)
*/
NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
struct dcerpc_packet *pkt,
- struct dcerpc_auth *auth_info)
+ struct dcerpc_auth *auth_info,
+ unsigned flags)
{
NTSTATUS status;
struct ndr_push *ndr;
@@ -233,6 +234,10 @@ NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
+ if (flags & DCERPC_PUSH_BIGENDIAN) {
+ ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
+ }
+
if (auth_info) {
pkt->auth_length = auth_info->credentials.length;
} else {
@@ -251,7 +256,7 @@ NTSTATUS dcerpc_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
*blob = ndr_push_blob(ndr);
/* fill in the frag length */
- SSVAL(blob->data, DCERPC_FRAG_LEN_OFFSET, blob->length);
+ dcerpc_set_frag_length(blob, blob->length);
return NT_STATUS_OK;
}
@@ -278,7 +283,8 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
} options[] = {
{"sign", DCERPC_SIGN},
{"seal", DCERPC_SEAL},
- {"validate", DCERPC_DEBUG_VALIDATE_BOTH}
+ {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
+ {"bigendian", DCERPC_PUSH_BIGENDIAN}
};
p = strchr(s, ':');