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

Alexandre Julliard julliard at wine.codeweavers.com
Sat May 20 11:22:46 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 0592210bcd45758cedac290be0958c3c67c41a09
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=0592210bcd45758cedac290be0958c3c67c41a09

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri May 19 16:02:23 2006 +0100

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.

---

 dlls/rpcrt4/rpc_defs.h    |    9 +++++++++
 dlls/rpcrt4/rpc_message.c |   20 ++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dlls/rpcrt4/rpc_defs.h b/dlls/rpcrt4/rpc_defs.h
index 454c1c6..896fea1 100644
--- a/dlls/rpcrt4/rpc_defs.h
+++ b/dlls/rpcrt4/rpc_defs.h
@@ -134,6 +134,15 @@ typedef union
   RpcPktBindNAckHdr bind_nack;
 } 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_MINOR             0
 
diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 6646ce7..f18cd47 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -271,8 +271,8 @@ static RPC_STATUS RPCRT4_SendAuth(RpcCon
   PUCHAR buffer_pos;
   DWORD hdr_size;
   LONG count;
-  unsigned char *pkt, *auth_hdr;
-  LONG alen = AuthLength ? (AuthLength + 8) : 0;
+  unsigned char *pkt;
+  LONG alen = AuthLength ? (AuthLength + sizeof(RpcAuthVerifier)) : 0;
 
   buffer_pos = Buffer;
   /* The packet building functions save the packet header size, so we can use it. */
@@ -309,16 +309,16 @@ static RPC_STATUS RPCRT4_SendAuth(RpcCon
     /* add the authorization info */
     if (Connection->AuthInfo && AuthLength)
     {
-      auth_hdr = &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;
+      RpcAuthVerifier *auth_hdr = (RpcAuthVerifier *)&pkt[Header->common.frag_len - alen];
 
+      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... */
-      memcpy(&auth_hdr[4], &Connection, 4);
-      memcpy(&auth_hdr[8], Auth, AuthLength);
+      auth_hdr->auth_context_id = (unsigned long)Connection;
+
+      memcpy(auth_hdr + 1, Auth, AuthLength);
     }
 
 write:




More information about the wine-cvs mailing list