Commit b24193c3 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Add a stub implementation of RpcImpersonateClient.

- More tracing, particularly on error paths.
parent 19731381
......@@ -399,7 +399,7 @@ RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid)
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection)
{
RpcBinding* NewBinding;
TRACE("(*RpcBinding == ^%p, Connection == ^%p)\n", *Binding, Connection);
TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
RPCRT4_AllocBinding(&NewBinding, Connection->server);
NewBinding->Protseq = RPCRT4_strdupA(Connection->Protseq);
......@@ -1096,3 +1096,22 @@ RPC_STATUS WINAPI RpcNetworkIsProtseqValidW(LPWSTR protseq) {
FIXME("Unknown protseq %s - we probably need to implement it one day\n", debugstr_w(protseq));
return RPC_S_PROTSEQ_NOT_SUPPORTED;
}
/***********************************************************************
* RpcImpersonateClient (RPCRT4.@)
*
* Impersonates the client connected via a binding handle so that security
* checks are done in the context of the client.
*
* PARAMS
* BindingHandle [I] Handle to the binding to the client.
*
* RETURNS
* Success: RPS_S_OK.
* Failure: RPC_STATUS value.
*/
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
{
FIXME("(%p): stub\n", BindingHandle);
return RPC_S_NO_CONTEXT_AVAILABLE;
}
......@@ -317,6 +317,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
}
}
if (dwRead != sizeof(common_hdr)) {
WARN("Short read of header, %ld/%d bytes\n", dwRead, sizeof(common_hdr));
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
......@@ -331,6 +332,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
hdr_length = RPCRT4_GetHeaderSize((RpcPktHdr*)&common_hdr);
if (hdr_length == 0) {
WARN("header length == 0\n");
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
......@@ -348,6 +350,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
}
}
if (dwRead != hdr_length - sizeof(common_hdr)) {
WARN("bad header length, %ld/%ld bytes\n", dwRead, hdr_length - sizeof(common_hdr));
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
......@@ -363,6 +366,9 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
default:
pMsg->BufferLength = common_hdr.frag_len - hdr_length;
}
TRACE("buffer length = %u\n", pMsg->BufferLength);
status = I_RpcGetBuffer(pMsg);
if (status != RPC_S_OK) goto fail;
......@@ -388,12 +394,15 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header,
}
}
if (dwRead != data_length) {
WARN("bad data length, %ld/%ld\n", dwRead, data_length);
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
/* when there is no more data left, it should be the last packet */
if (buffer_length == pMsg->BufferLength &&
((*Header)->common.flags & RPC_FLG_LAST) == 0) {
WARN("no more data left, but not last packet\n");
status = RPC_S_PROTOCOL_ERROR;
goto fail;
}
......@@ -580,6 +589,7 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
status = RPC_S_CALL_FAILED; /* ? */
goto fail;
default:
WARN("bad packet type %d\n", hdr->common.ptype);
goto fail;
}
......
......@@ -72,7 +72,7 @@
@ stub RpcGetAsyncCallStatus
@ stub RpcIfIdVectorFree
@ stub RpcIfInqId
@ stub RpcImpersonateClient
@ stdcall RpcImpersonateClient(ptr)
@ stub RpcInitializeAsyncHandle
@ stub RpcMgmtBindingInqParameter # win9x
@ stub RpcMgmtBindingSetParameter # win9x
......
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