Merge pull request #1092 from awakecoding/master

winpr-makecert fix
This commit is contained in:
Marc-André Moreau 2013-03-13 14:58:07 -07:00
commit 4caaa7a1d3
3 changed files with 70 additions and 57 deletions

View File

@ -201,14 +201,13 @@ BOOL TsProxyCreateTunnelWriteRequest(rdpTsg* tsg)
return TRUE;
}
BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
BYTE* buffer;
UINT32 count;
UINT32 length;
UINT32 offset;
UINT32 Pointer;
RPC_PDU* pdu;
PTSG_PACKET packet;
UINT32 SwitchValue;
rdpRpc* rpc = tsg->rpc;
@ -217,8 +216,6 @@ BOOL TsProxyCreateTunnelReadResponse(rdpTsg* tsg)
PTSG_PACKET_CAPS_RESPONSE packetCapsResponse;
PTSG_PACKET_QUARENC_RESPONSE packetQuarEncResponse;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!pdu)
return FALSE;
@ -467,12 +464,6 @@ BOOL TsProxyCreateTunnel(rdpTsg* tsg, PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPac
return FALSE;
}
if (!TsProxyCreateTunnelReadResponse(tsg))
{
printf("TsProxyCreateTunnel: error reading response\n");
return FALSE;
}
return TRUE;
}
@ -541,9 +532,8 @@ BOOL TsProxyAuthorizeTunnelWriteRequest(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSE
return TRUE;
}
BOOL TsProxyAuthorizeTunnelReadResponse(rdpTsg* tsg)
BOOL TsProxyAuthorizeTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
@ -554,8 +544,6 @@ BOOL TsProxyAuthorizeTunnelReadResponse(rdpTsg* tsg)
rdpRpc* rpc = tsg->rpc;
PTSG_PACKET_RESPONSE packetResponse;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!pdu)
return FALSE;
@ -646,12 +634,6 @@ BOOL TsProxyAuthorizeTunnel(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunn
return FALSE;
}
if (!TsProxyAuthorizeTunnelReadResponse(tsg))
{
printf("TsProxyAuthorizeTunnel: error reading response\n");
return FALSE;
}
return TRUE;
}
@ -692,9 +674,8 @@ BOOL TsProxyMakeTunnelCallWriteRequest(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSER
return TRUE;
}
BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg)
BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
@ -703,17 +684,12 @@ BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg)
UINT32 ActualCount;
UINT32 SwitchValue;
PTSG_PACKET packet;
rdpRpc* rpc = tsg->rpc;
PTSG_PACKET_MSG_RESPONSE packetMsgResponse;
PTSG_PACKET_STRING_MESSAGE packetStringMessage = NULL;
PTSG_PACKET_REAUTH_MESSAGE packetReauthMessage = NULL;
/* This is an asynchronous response */
return TRUE;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!pdu)
return FALSE;
@ -828,12 +804,6 @@ BOOL TsProxyMakeTunnelCall(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunne
return FALSE;
}
if (!TsProxyMakeTunnelCallReadResponse(tsg))
{
printf("TsProxyMakeTunnelCall: error reading response\n");
return FALSE;
}
return TRUE;
}
@ -892,16 +862,13 @@ BOOL TsProxyCreateChannelWriteRequest(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSERI
return TRUE;
}
BOOL TsProxyCreateChannelReadResponse(rdpTsg* tsg)
BOOL TsProxyCreateChannelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
rdpRpc* rpc = tsg->rpc;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!pdu)
return FALSE;
@ -950,12 +917,6 @@ BOOL TsProxyCreateChannel(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnel
return FALSE;
}
if (!TsProxyCreateChannelReadResponse(tsg))
{
printf("TsProxyCreateChannel: error reading response\n");
return FALSE;
}
return TRUE;
}
@ -983,9 +944,8 @@ BOOL TsProxyCloseChannelWriteRequest(rdpTsg* tsg, PCHANNEL_CONTEXT_HANDLE_NOSERI
return TRUE;
}
BOOL TsProxyCloseChannelReadResponse(rdpTsg* tsg)
BOOL TsProxyCloseChannelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
@ -1011,6 +971,8 @@ BOOL TsProxyCloseChannelReadResponse(rdpTsg* tsg)
HRESULT TsProxyCloseChannel(rdpTsg* tsg, PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* context)
{
RPC_PDU* pdu = NULL;
/**
* HRESULT TsProxyCloseChannel(
* [in, out] PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* context
@ -1025,7 +987,7 @@ HRESULT TsProxyCloseChannel(rdpTsg* tsg, PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* co
return FALSE;
}
if (!TsProxyCloseChannelReadResponse(tsg))
if (!TsProxyCloseChannelReadResponse(tsg, pdu))
{
printf("TsProxyCloseChannel: error reading response\n");
return FALSE;
@ -1058,9 +1020,8 @@ BOOL TsProxyCloseTunnelWriteRequest(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_SERIALIZ
return TRUE;
}
BOOL TsProxyCloseTunnelReadResponse(rdpTsg* tsg)
BOOL TsProxyCloseTunnelReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
RPC_PDU* pdu;
BYTE* buffer;
UINT32 length;
UINT32 offset;
@ -1086,6 +1047,8 @@ BOOL TsProxyCloseTunnelReadResponse(rdpTsg* tsg)
HRESULT TsProxyCloseTunnel(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_SERIALIZE* context)
{
RPC_PDU* pdu = NULL;
/**
* HRESULT TsProxyCloseTunnel(
* [in, out] PTUNNEL_CONTEXT_HANDLE_SERIALIZE* context
@ -1100,7 +1063,7 @@ HRESULT TsProxyCloseTunnel(rdpTsg* tsg, PTUNNEL_CONTEXT_HANDLE_SERIALIZE* contex
return FALSE;
}
if (!TsProxyCloseTunnelReadResponse(tsg))
if (!TsProxyCloseTunnelReadResponse(tsg, pdu))
{
printf("TsProxyCloseTunnel: error reading response\n");
return FALSE;
@ -1134,7 +1097,7 @@ BOOL TsProxySetupReceivePipeWriteRequest(rdpTsg* tsg)
return TRUE;
}
BOOL TsProxySetupReceivePipeReadResponse(rdpTsg* tsg)
BOOL TsProxySetupReceivePipeReadResponse(rdpTsg* tsg, RPC_PDU* pdu)
{
return TRUE;
}
@ -1161,17 +1124,12 @@ BOOL TsProxySetupReceivePipe(handle_t IDL_handle, BYTE* pRpcMessage)
return FALSE;
}
if (!TsProxySetupReceivePipeReadResponse(tsg))
{
printf("TsProxySetupReceivePipe: error reading response\n");
return FALSE;
}
return TRUE;
}
BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
{
RPC_PDU* pdu = NULL;
rdpRpc* rpc = tsg->rpc;
rdpSettings* settings = rpc->settings;
@ -1240,6 +1198,14 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
return FALSE;
}
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxyCreateTunnelReadResponse(tsg, pdu))
{
printf("TsProxyCreateTunnel: error reading response\n");
return FALSE;
}
tsg->state = TSG_STATE_CONNECTED;
/**
@ -1278,6 +1244,14 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
return FALSE;
}
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxyAuthorizeTunnelReadResponse(tsg, pdu))
{
printf("TsProxyAuthorizeTunnel: error reading response\n");
return FALSE;
}
tsg->state = TSG_STATE_AUTHORIZED;
/**
@ -1291,6 +1265,16 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
if (!TsProxyMakeTunnelCall(tsg, &tsg->TunnelContext, TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST, NULL, NULL))
return FALSE;
#if 0
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxyMakeTunnelCallReadResponse(tsg, pdu))
{
printf("TsProxyMakeTunnelCall: error reading response\n");
return FALSE;
}
#endif
/**
* Sequential processing rules for connection process (continued):
*
@ -1310,6 +1294,14 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
if (!TsProxyCreateChannel(tsg, &tsg->TunnelContext, NULL, NULL, NULL))
return FALSE;
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxyCreateChannelReadResponse(tsg, pdu))
{
printf("TsProxyCreateChannel: error reading response\n");
return FALSE;
}
tsg->state = TSG_STATE_CHANNEL_CREATED;
/**
@ -1330,6 +1322,16 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
if (!TsProxySetupReceivePipe((handle_t) tsg, NULL))
return FALSE;
#if 0
pdu = rpc_recv_dequeue_pdu(rpc);
if (!TsProxySetupReceivePipeReadResponse(tsg, pdu))
{
printf("TsProxySetupReceivePipe: error reading response\n");
return FALSE;
}
#endif
rpc->client->SynchronousSend = TRUE;
rpc->client->SynchronousReceive = TRUE;

View File

@ -21,12 +21,19 @@ set(MODULE_PREFIX "WINPR_TOOLS_MAKECERT")
set(${MODULE_PREFIX}_SRCS
makecert.c)
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(${OPENSSL_INCLUDE_DIR})
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set(${MODULE_PREFIX}_LIBS
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-utils)
MODULES winpr-crt winpr-utils winpr-sysinfo)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})

View File

@ -29,6 +29,10 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
#ifdef _WIN32
#include <openssl/applink.c>
#endif
X509* x509 = NULL;
EVP_PKEY* pkey = NULL;
char* output_file = NULL;