Commit 0592210b authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

rpcrt4: Add the definition of RpcAuthVerifier to rpc_defs.h from the DCE/RPC spec.

Use it in RPCRT4_SendAuth instead of writing out the data byte-by-byte.
parent 46005c2f
...@@ -134,6 +134,15 @@ typedef union ...@@ -134,6 +134,15 @@ typedef union
RpcPktBindNAckHdr bind_nack; RpcPktBindNAckHdr bind_nack;
} RpcPktHdr; } RpcPktHdr;
typedef struct
{
unsigned char auth_type; /* authentication scheme in use */
unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */
unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */
unsigned char auth_reserved; /* reserved, must be zero */
unsigned long auth_context_id; /* unique value for the authenticated connection */
} RpcAuthVerifier;
#define RPC_VER_MAJOR 5 #define RPC_VER_MAJOR 5
#define RPC_VER_MINOR 0 #define RPC_VER_MINOR 0
......
...@@ -271,8 +271,8 @@ static RPC_STATUS RPCRT4_SendAuth(RpcConnection *Connection, RpcPktHdr *Header, ...@@ -271,8 +271,8 @@ static RPC_STATUS RPCRT4_SendAuth(RpcConnection *Connection, RpcPktHdr *Header,
PUCHAR buffer_pos; PUCHAR buffer_pos;
DWORD hdr_size; DWORD hdr_size;
LONG count; LONG count;
unsigned char *pkt, *auth_hdr; unsigned char *pkt;
LONG alen = AuthLength ? (AuthLength + 8) : 0; LONG alen = AuthLength ? (AuthLength + sizeof(RpcAuthVerifier)) : 0;
buffer_pos = Buffer; buffer_pos = Buffer;
/* The packet building functions save the packet header size, so we can use it. */ /* The packet building functions save the packet header size, so we can use it. */
...@@ -309,16 +309,16 @@ static RPC_STATUS RPCRT4_SendAuth(RpcConnection *Connection, RpcPktHdr *Header, ...@@ -309,16 +309,16 @@ static RPC_STATUS RPCRT4_SendAuth(RpcConnection *Connection, RpcPktHdr *Header,
/* add the authorization info */ /* add the authorization info */
if (Connection->AuthInfo && AuthLength) if (Connection->AuthInfo && AuthLength)
{ {
auth_hdr = &pkt[Header->common.frag_len - alen]; RpcAuthVerifier *auth_hdr = (RpcAuthVerifier *)&pkt[Header->common.frag_len - alen];
auth_hdr[0] = Connection->AuthInfo->AuthnSvc;
auth_hdr[1] = Connection->AuthInfo->AuthnLevel;
auth_hdr[2] = auth_pad_len;
auth_hdr[3] = 0x00;
auth_hdr->auth_type = Connection->AuthInfo->AuthnSvc;
auth_hdr->auth_level = Connection->AuthInfo->AuthnLevel;
auth_hdr->auth_pad_length = auth_pad_len;
auth_hdr->auth_reserved = 0;
/* a unique number... */ /* a unique number... */
memcpy(&auth_hdr[4], &Connection, 4); auth_hdr->auth_context_id = (unsigned long)Connection;
memcpy(&auth_hdr[8], Auth, AuthLength);
memcpy(auth_hdr + 1, Auth, AuthLength);
} }
write: write:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment