rpcrt4: Close the connection if a protocol error or certain other kinds of errors occur, instead of returning it to the connection pool.
This commit is contained in:
parent
0d05685b68
commit
c411d95e20
|
@ -952,6 +952,23 @@ RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* is this status something that the server can't recover from? */
|
||||||
|
static inline BOOL is_hard_error(RPC_STATUS status)
|
||||||
|
{
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case 0: /* user-defined fault */
|
||||||
|
case ERROR_ACCESS_DENIED:
|
||||||
|
case ERROR_INVALID_PARAMETER:
|
||||||
|
case RPC_S_PROTOCOL_ERROR:
|
||||||
|
case RPC_S_CALL_FAILED:
|
||||||
|
case RPC_S_CALL_FAILED_DNE:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* I_RpcReceive [RPCRT4.@]
|
* I_RpcReceive [RPCRT4.@]
|
||||||
*/
|
*/
|
||||||
|
@ -999,31 +1016,40 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = RPC_S_PROTOCOL_ERROR;
|
|
||||||
|
|
||||||
switch (hdr->common.ptype) {
|
switch (hdr->common.ptype) {
|
||||||
case PKT_RESPONSE:
|
case PKT_RESPONSE:
|
||||||
if (bind->server) goto fail;
|
if (bind->server) {
|
||||||
|
status = RPC_S_PROTOCOL_ERROR;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PKT_REQUEST:
|
case PKT_REQUEST:
|
||||||
if (!bind->server) goto fail;
|
if (!bind->server) {
|
||||||
|
status = RPC_S_PROTOCOL_ERROR;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PKT_FAULT:
|
case PKT_FAULT:
|
||||||
pMsg->RpcFlags |= WINE_RPCFLAG_EXCEPTION;
|
pMsg->RpcFlags |= WINE_RPCFLAG_EXCEPTION;
|
||||||
ERR ("we got fault packet with status 0x%lx\n", hdr->fault.status);
|
ERR ("we got fault packet with status 0x%lx\n", hdr->fault.status);
|
||||||
status = hdr->fault.status; /* FIXME: do translation from nca error codes */
|
status = hdr->fault.status; /* FIXME: do translation from nca error codes */
|
||||||
goto fail;
|
if (is_hard_error(status))
|
||||||
|
goto fail;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
WARN("bad packet type %d\n", hdr->common.ptype);
|
WARN("bad packet type %d\n", hdr->common.ptype);
|
||||||
|
status = RPC_S_PROTOCOL_ERROR;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
status = RPC_S_OK;
|
RPCRT4_CloseBinding(bind, conn);
|
||||||
|
RPCRT4_FreeHeader(hdr);
|
||||||
|
return status;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
RPCRT4_FreeHeader(hdr);
|
RPCRT4_FreeHeader(hdr);
|
||||||
RPCRT4_CloseBinding(bind, conn);
|
RPCRT4_DestroyConnection(conn);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue