From c66972dfbabf5b16705716d595ee198b730f50f0 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Tue, 19 Jan 2010 10:30:31 +0000 Subject: [PATCH] rpcrt4: Add structure definition for RPC AUTH3 packet and use the size of this on sending to fix authentication against native servers. Also use the new size to validate incoming AUTH3 packets to be consistent with native. --- dlls/rpcrt4/rpc_defs.h | 8 ++++++++ dlls/rpcrt4/rpc_message.c | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/rpcrt4/rpc_defs.h b/dlls/rpcrt4/rpc_defs.h index 8514967a9c9..434d39699ee 100644 --- a/dlls/rpcrt4/rpc_defs.h +++ b/dlls/rpcrt4/rpc_defs.h @@ -139,6 +139,13 @@ typedef struct unsigned short num_data_items; } RpcPktHttpHdr; +/* AUTH3 packet */ +typedef struct +{ + RpcPktCommonHdr common; + unsigned int pad; /* ignored */ +} RpcPktAuth3Hdr; + /* Union representing all possible packet headers */ typedef union { @@ -150,6 +157,7 @@ typedef union RpcPktBindAckHdr bind_ack; RpcPktBindNAckHdr bind_nack; RpcPktHttpHdr http; + RpcPktAuth3Hdr auth3; } RpcPktHdr; typedef struct diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c index 45a0398c846..0144f85dbfd 100644 --- a/dlls/rpcrt4/rpc_message.c +++ b/dlls/rpcrt4/rpc_message.c @@ -59,7 +59,7 @@ DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header) sizeof(Header->request), 0, sizeof(Header->response), sizeof(Header->fault), 0, 0, 0, 0, 0, 0, 0, sizeof(Header->bind), sizeof(Header->bind_ack), sizeof(Header->bind_nack), - 0, 0, sizeof(Header->common), 0, 0, 0, sizeof(Header->http) + 0, 0, sizeof(Header->auth3), 0, 0, 0, sizeof(Header->http) }; ULONG ret = 0; @@ -217,12 +217,12 @@ static RpcPktHdr *RPCRT4_BuildAuthHeader(ULONG DataRepresentation) RpcPktHdr *header; header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(header->common)); + sizeof(header->auth3)); if (header == NULL) return NULL; RPCRT4_BuildCommonHeader(header, PKT_AUTH3, DataRepresentation); - header->common.frag_len = sizeof(header->common); + header->common.frag_len = sizeof(header->auth3); return header; }