Rob Shearman : rpcrt4: Add new function RPCRT4_ReceiveWithAuth to receive a fragment and return the authentication data received , if any.
Alexandre Julliard
julliard at winehq.org
Thu Jun 19 06:37:49 CDT 2008
Module: wine
Branch: master
Commit: 6bb03d7dbad1c713916734099c4136751bc4f1a0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6bb03d7dbad1c713916734099c4136751bc4f1a0
Author: Rob Shearman <robertshearman at gmail.com>
Date: Wed Jun 18 17:32:12 2008 +0100
rpcrt4: Add new function RPCRT4_ReceiveWithAuth to receive a fragment and return the authentication data received, if any.
---
dlls/rpcrt4/rpc_message.c | 37 +++++++++++++++++++++++++++----------
dlls/rpcrt4/rpc_message.h | 1 +
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index f686726..fc89e2a 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -795,19 +795,22 @@ fail:
}
/***********************************************************************
- * RPCRT4_Receive (internal)
+ * RPCRT4_ReceiveWithAuth (internal)
*
- * Receive a packet from connection and merge the fragments.
+ * Receive a packet from connection, merge the fragments and return the auth
+ * data.
*/
-RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
- PRPC_MESSAGE pMsg)
+RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
+ PRPC_MESSAGE pMsg,
+ unsigned char **auth_data_out,
+ unsigned long *auth_length_out)
{
RPC_STATUS status;
DWORD hdr_length;
unsigned short first_flag;
unsigned long data_length;
unsigned long buffer_length;
- unsigned long auth_length;
+ unsigned long auth_length = 0;
unsigned char *auth_data = NULL;
RpcPktHdr *CurrentHeader = NULL;
void *payload = NULL;
@@ -815,7 +818,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
*Header = NULL;
pMsg->Buffer = NULL;
- TRACE("(%p, %p, %p)\n", Connection, Header, pMsg);
+ TRACE("(%p, %p, %p, %p)\n", Connection, Header, pMsg, auth_data_out);
RPCRT4_SetThreadCurrentConnection(Connection);
@@ -911,9 +914,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
/* these packets are handled specially, not by the generic SecurePacket
* function */
- if (((*Header)->common.ptype != PKT_BIND) &&
- ((*Header)->common.ptype != PKT_BIND_ACK) &&
- ((*Header)->common.ptype != PKT_AUTH3))
+ if (!auth_data_out && SecIsValidHandle(&Connection->ctx))
{
status = RPCRT4_SecurePacket(Connection, SECURE_PACKET_RECEIVE,
CurrentHeader, hdr_length,
@@ -970,12 +971,28 @@ fail:
RPCRT4_FreeHeader(*Header);
*Header = NULL;
}
- HeapFree(GetProcessHeap(), 0, auth_data);
+ if (auth_data_out && status == RPC_S_OK) {
+ *auth_length_out = auth_length;
+ *auth_data_out = auth_data;
+ }
+ else
+ HeapFree(GetProcessHeap(), 0, auth_data);
HeapFree(GetProcessHeap(), 0, payload);
return status;
}
/***********************************************************************
+ * RPCRT4_Receive (internal)
+ *
+ * Receive a packet from connection and merge the fragments.
+ */
+RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
+ PRPC_MESSAGE pMsg)
+{
+ return RPCRT4_ReceiveWithAuth(Connection, Header, pMsg, NULL, NULL);
+}
+
+/***********************************************************************
* I_RpcNegotiateTransferSyntax [RPCRT4.@]
*
* Negotiates the transfer syntax used by a client connection by connecting
diff --git a/dlls/rpcrt4/rpc_message.h b/dlls/rpcrt4/rpc_message.h
index cbf83d3..a9378fa 100644
--- a/dlls/rpcrt4/rpc_message.h
+++ b/dlls/rpcrt4/rpc_message.h
@@ -34,6 +34,7 @@ RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned
VOID RPCRT4_FreeHeader(RpcPktHdr *Header);
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength);
RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg);
+RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, unsigned long *auth_length_out);
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status);
RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status);
More information about the wine-cvs
mailing list