From 24c22aef90d8534ee2d016b37b2b302f1367d106 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 16 Dec 2003 09:02:58 +0000 Subject: 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) --- source4/rpc_server/dcerpc_server.c | 13 ++++++------- source4/rpc_server/dcesrv_auth.c | 2 +- source4/rpc_server/epmapper/rpc_epmapper.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'source4/rpc_server') diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index f3c7a63c79..5780de0c30 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -209,7 +209,7 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32 fault_code) return NT_STATUS_NO_MEMORY; } - status = dcerpc_push_auth(&rep->data, call->mem_ctx, &pkt, NULL); + status = dcerpc_push_auth(&rep->data, call->mem_ctx, &pkt, NULL, 0); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -266,7 +266,7 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32 reason) return NT_STATUS_NO_MEMORY; } - status = dcerpc_push_auth(&rep->data, call->mem_ctx, &pkt, NULL); + status = dcerpc_push_auth(&rep->data, call->mem_ctx, &pkt, NULL, 0); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -296,13 +296,13 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) return dcesrv_bind_nak(call, 0); } - if_version = call->pkt.u.bind.ctx_list[0].abstract_syntax.major_version; + if_version = call->pkt.u.bind.ctx_list[0].abstract_syntax.if_version; uuid = GUID_string(call->mem_ctx, &call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid); if (!uuid) { return dcesrv_bind_nak(call, 0); } - transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].major_version; + transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].if_version; transfer_syntax = GUID_string(call->mem_ctx, &call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].uuid); if (!transfer_syntax || @@ -356,8 +356,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) pkt.u.bind_ack.ctx_list[0].result = result; pkt.u.bind_ack.ctx_list[0].reason = reason; GUID_from_string(NDR_GUID, &pkt.u.bind_ack.ctx_list[0].syntax.uuid); - pkt.u.bind_ack.ctx_list[0].syntax.major_version = NDR_GUID_VERSION; - pkt.u.bind_ack.ctx_list[0].syntax.minor_version = 0; + pkt.u.bind_ack.ctx_list[0].syntax.if_version = NDR_GUID_VERSION; pkt.u.bind_ack.auth_info = data_blob(NULL, 0); if (!dcesrv_auth_bind_ack(call, &pkt)) { @@ -370,7 +369,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) } status = dcerpc_push_auth(&rep->data, call->mem_ctx, &pkt, - call->dce->auth_state.auth_info); + call->dce->auth_state.auth_info, 0); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index f290c741cb..0f4b22ee3d 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -232,7 +232,7 @@ BOOL dcesrv_auth_response(struct dcesrv_call_state *call, /* non-signed packets are simple */ if (!dce->auth_state.auth_info || !dce->auth_state.ntlmssp_state) { - status = dcerpc_push_auth(blob, call->mem_ctx, pkt, NULL); + status = dcerpc_push_auth(blob, call->mem_ctx, pkt, NULL, 0); return NT_STATUS_IS_OK(status); } diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c index f2ecc0faa9..5e571ee1ef 100644 --- a/source4/rpc_server/epmapper/rpc_epmapper.c +++ b/source4/rpc_server/epmapper/rpc_epmapper.c @@ -30,7 +30,7 @@ enum handle_types {HTYPE_LOOKUP}; /* simple routine to compare a GUID string to a GUID structure */ -static int guid_cmp(TALLOC_CTX *mem_ctx, const GUID *guid, const char *uuid_str) +static int guid_cmp(TALLOC_CTX *mem_ctx, const struct GUID *guid, const char *uuid_str) { const char *s = GUID_string(mem_ctx, guid); if (!s || strcasecmp(s, uuid_str)) { -- cgit