Commit 6bb26abe authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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.
parent 6bb03d7d
...@@ -222,6 +222,8 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * ...@@ -222,6 +222,8 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
RpcPktHdr *response_hdr; RpcPktHdr *response_hdr;
RPC_MESSAGE msg; RPC_MESSAGE msg;
RPC_STATUS status; RPC_STATUS status;
unsigned char *auth_data = NULL;
unsigned long auth_length;
TRACE("sending bind request to server\n"); TRACE("sending bind request to server\n");
...@@ -235,10 +237,10 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * ...@@ -235,10 +237,10 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
if (status != RPC_S_OK) if (status != RPC_S_OK)
return status; 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) if (status != RPC_S_OK)
{ {
ERR("receive failed\n"); ERR("receive failed with error %ld\n", status);
return status; return status;
} }
...@@ -259,9 +261,17 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * ...@@ -259,9 +261,17 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
switch (results->results[0].result) switch (results->results[0].result)
{ {
case RESULT_ACCEPT: case RESULT_ACCEPT:
conn->assoc_group_id = response_hdr->bind_ack.assoc_gid; /* respond to authorization request */
conn->MaxTransmissionSize = response_hdr->bind_ack.max_tsize; if (auth_length > sizeof(RpcAuthVerifier))
conn->ActiveInterface = *InterfaceId; 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; break;
case RESULT_PROVIDER_REJECTION: case RESULT_PROVIDER_REJECTION:
switch (results->results[0].reason) switch (results->results[0].reason)
...@@ -334,6 +344,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * ...@@ -334,6 +344,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
I_RpcFree(msg.Buffer); I_RpcFree(msg.Buffer);
RPCRT4_FreeHeader(response_hdr); RPCRT4_FreeHeader(response_hdr);
HeapFree(GetProcessHeap(), 0, auth_data);
return status; return status;
} }
......
...@@ -631,8 +631,8 @@ failed: ...@@ -631,8 +631,8 @@ failed:
/*********************************************************************** /***********************************************************************
* RPCRT4_AuthorizeBinding (internal) * RPCRT4_AuthorizeBinding (internal)
*/ */
static RPC_STATUS RPCRT_AuthorizeConnection(RpcConnection* conn, RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge,
BYTE *challenge, ULONG count) ULONG count)
{ {
SecBuffer inp, out; SecBuffer inp, out;
RpcPktHdr *resp_hdr; RpcPktHdr *resp_hdr;
...@@ -948,16 +948,6 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, ...@@ -948,16 +948,6 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
} }
pMsg->BufferLength = buffer_length; 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 */ /* success */
status = RPC_S_OK; status = RPC_S_OK;
......
...@@ -37,5 +37,6 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_ME ...@@ -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); 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); NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status);
RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status); RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status);
RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count);
#endif #endif
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