rpcrt4: Make RpcAssoc_BindConnection use RPCRT4_ReceiveWithAuth instead of RPCRT4_Receive.

Move the special handling of the PKT_BIND_ACK packet from
RPCRT4_ReceiveWithAuth to RpcAssoc_BindConnection, where it belongs.
This commit is contained in:
Rob Shearman 2008-06-18 17:32:22 +01:00 committed by Alexandre Julliard
parent 6bb03d7dba
commit 6bb26abe81
3 changed files with 19 additions and 17 deletions

View File

@ -222,6 +222,8 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
RpcPktHdr *response_hdr;
RPC_MESSAGE msg;
RPC_STATUS status;
unsigned char *auth_data = NULL;
unsigned long auth_length;
TRACE("sending bind request to server\n");
@ -235,10 +237,10 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
if (status != RPC_S_OK)
return status;
status = RPCRT4_Receive(conn, &response_hdr, &msg);
status = RPCRT4_ReceiveWithAuth(conn, &response_hdr, &msg, &auth_data, &auth_length);
if (status != RPC_S_OK)
{
ERR("receive failed\n");
ERR("receive failed with error %ld\n", status);
return status;
}
@ -259,9 +261,17 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
switch (results->results[0].result)
{
case RESULT_ACCEPT:
conn->assoc_group_id = response_hdr->bind_ack.assoc_gid;
conn->MaxTransmissionSize = response_hdr->bind_ack.max_tsize;
conn->ActiveInterface = *InterfaceId;
/* respond to authorization request */
if (auth_length > sizeof(RpcAuthVerifier))
status = RPCRT4_AuthorizeConnection(conn,
auth_data + sizeof(RpcAuthVerifier),
auth_length);
if (status == RPC_S_OK)
{
conn->assoc_group_id = response_hdr->bind_ack.assoc_gid;
conn->MaxTransmissionSize = response_hdr->bind_ack.max_tsize;
conn->ActiveInterface = *InterfaceId;
}
break;
case RESULT_PROVIDER_REJECTION:
switch (results->results[0].reason)
@ -334,6 +344,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
I_RpcFree(msg.Buffer);
RPCRT4_FreeHeader(response_hdr);
HeapFree(GetProcessHeap(), 0, auth_data);
return status;
}

View File

@ -631,8 +631,8 @@ failed:
/***********************************************************************
* RPCRT4_AuthorizeBinding (internal)
*/
static RPC_STATUS RPCRT_AuthorizeConnection(RpcConnection* conn,
BYTE *challenge, ULONG count)
RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge,
ULONG count)
{
SecBuffer inp, out;
RpcPktHdr *resp_hdr;
@ -948,16 +948,6 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
}
pMsg->BufferLength = buffer_length;
/* respond to authorization request */
if ((*Header)->common.ptype == PKT_BIND_ACK && auth_length > sizeof(RpcAuthVerifier))
{
status = RPCRT_AuthorizeConnection(Connection,
auth_data + sizeof(RpcAuthVerifier),
auth_length);
if (status)
goto fail;
}
/* success */
status = RPC_S_OK;

View File

@ -37,5 +37,6 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_ME
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);
RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count);
#endif