[core,rdp] use a dynamic logger for rdpRdp
This commit is contained in:
parent
9b67ef1a87
commit
a433e1b761
@ -4327,7 +4327,7 @@ BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId, UIN
|
||||
|
||||
if (rdp->settings->UseRdpSecurityLayer)
|
||||
{
|
||||
if (!rdp_read_security_header(s, &securityFlags, length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, length))
|
||||
return FALSE;
|
||||
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
@ -4370,7 +4370,7 @@ BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)
|
||||
if (freerdp_shall_disconnect_context(rdp->context))
|
||||
return TRUE;
|
||||
|
||||
if (!rdp_read_share_control_header(s, NULL, NULL, &pduType, &pduSource))
|
||||
if (!rdp_read_share_control_header(rdp, s, NULL, NULL, &pduType, &pduSource))
|
||||
return FALSE;
|
||||
|
||||
if (pduType == PDU_TYPE_DATA)
|
||||
|
@ -706,9 +706,12 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
|
||||
wStream* s = NULL;
|
||||
int status = 0;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
WINPR_ASSERT(rdp);
|
||||
rdpSettings* settings = rdp->settings;
|
||||
BYTE* crypt_client_random = NULL;
|
||||
|
||||
WINPR_ASSERT(settings);
|
||||
if (!settings->UseRdpSecurityLayer)
|
||||
{
|
||||
/* no RDP encryption */
|
||||
@ -755,7 +758,7 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
|
||||
|
||||
if (!rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID))
|
||||
goto end;
|
||||
if (!rdp_write_security_header(s, SEC_EXCHANGE_PKT | SEC_LICENSE_ENCRYPT_SC))
|
||||
if (!rdp_write_security_header(rdp, s, SEC_EXCHANGE_PKT | SEC_LICENSE_ENCRYPT_SC))
|
||||
goto end;
|
||||
|
||||
Stream_Write_UINT32(s, info->ModulusLength + 8);
|
||||
@ -860,6 +863,8 @@ BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
|
||||
UINT16 sec_flags = 0;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
WINPR_ASSERT(rdp);
|
||||
|
||||
if (!rdp->settings->UseRdpSecurityLayer)
|
||||
{
|
||||
/* No RDP Security. */
|
||||
@ -869,7 +874,7 @@ BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
|
||||
if (!rdp_read_header(rdp, s, &length, &channel_id))
|
||||
return FALSE;
|
||||
|
||||
if (!rdp_read_security_header(s, &sec_flags, NULL))
|
||||
if (!rdp_read_security_header(rdp, s, &sec_flags, NULL))
|
||||
{
|
||||
WLog_ERR(TAG, "invalid security header");
|
||||
return FALSE;
|
||||
@ -1127,7 +1132,7 @@ BOOL rdp_client_connect_auto_detect(rdpRdp* rdp, wStream* s)
|
||||
{
|
||||
UINT16 securityFlags = 0;
|
||||
|
||||
if (!rdp_read_security_header(s, &securityFlags, &length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, &length))
|
||||
return FALSE;
|
||||
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
@ -1158,10 +1163,11 @@ state_run_t rdp_client_connect_license(rdpRdp* rdp, wStream* s)
|
||||
LICENSE_STATE state;
|
||||
UINT16 length, channelId, securityFlags;
|
||||
|
||||
WINPR_ASSERT(rdp);
|
||||
if (!rdp_read_header(rdp, s, &length, &channelId))
|
||||
return STATE_RUN_FAILED;
|
||||
|
||||
if (!rdp_read_security_header(s, &securityFlags, &length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, &length))
|
||||
return STATE_RUN_FAILED;
|
||||
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
|
@ -366,7 +366,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
|
||||
WINPR_ASSERT(pointer);
|
||||
|
||||
#ifdef WITH_DEBUG_RDP
|
||||
DEBUG_RDP("recv Fast-Path %s Update (0x%02" PRIX8 "), length:%" PRIuz "",
|
||||
DEBUG_RDP(fastpath->rdp, "recv Fast-Path %s Update (0x%02" PRIX8 "), length:%" PRIuz "",
|
||||
fastpath_update_to_string(updateCode), updateCode, Stream_GetRemainingLength(s));
|
||||
#endif
|
||||
|
||||
|
@ -728,8 +728,6 @@ BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings)
|
||||
|
||||
WINPR_ASSERT(instance);
|
||||
|
||||
rdp_log_build_warnings();
|
||||
|
||||
instance->context = context = (rdpContext*)calloc(1, instance->ContextSize);
|
||||
|
||||
if (!context)
|
||||
@ -755,6 +753,7 @@ BOOL freerdp_context_new_ex(freerdp* instance, rdpSettings* settings)
|
||||
if (!rdp)
|
||||
goto fail;
|
||||
|
||||
rdp_log_build_warnings(rdp);
|
||||
context->rdp = rdp;
|
||||
context->pubSub = rdp->pubSub;
|
||||
|
||||
|
@ -987,7 +987,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s)
|
||||
if (!rdp_read_header(rdp, s, &length, &channelId))
|
||||
return FALSE;
|
||||
|
||||
if (!rdp_read_security_header(s, &securityFlags, &length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, &length))
|
||||
return FALSE;
|
||||
|
||||
if ((securityFlags & SEC_INFO_PKT) == 0)
|
||||
|
@ -340,13 +340,14 @@ static state_run_t peer_recv_data_pdu(freerdp_peer* client, wStream* s, UINT16 t
|
||||
update = client->context->update;
|
||||
WINPR_ASSERT(update);
|
||||
|
||||
if (!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type,
|
||||
&compressed_len))
|
||||
if (!rdp_read_share_data_header(client->context->rdp, s, &length, &type, &share_id,
|
||||
&compressed_type, &compressed_len))
|
||||
return STATE_RUN_FAILED;
|
||||
|
||||
#ifdef WITH_DEBUG_RDP
|
||||
WLog_DBG(TAG, "recv %s Data PDU (0x%02" PRIX8 "), length: %" PRIu16 "",
|
||||
data_pdu_type_to_string(type), type, length);
|
||||
WLog_Print(client->context->rdp, WLOG_DEBUG,
|
||||
"recv %s Data PDU (0x%02" PRIX8 "), length: %" PRIu16 "",
|
||||
data_pdu_type_to_string(type), type, length);
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
@ -444,7 +445,7 @@ static state_run_t peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
|
||||
|
||||
if (rdp_get_state(rdp) <= CONNECTION_STATE_LICENSING)
|
||||
{
|
||||
if (!rdp_read_security_header(s, &securityFlags, &length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, &length))
|
||||
return STATE_RUN_FAILED;
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
{
|
||||
@ -456,7 +457,7 @@ static state_run_t peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
|
||||
|
||||
if (settings->UseRdpSecurityLayer)
|
||||
{
|
||||
if (!rdp_read_security_header(s, &securityFlags, &length))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, &length))
|
||||
return STATE_RUN_FAILED;
|
||||
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
@ -470,7 +471,7 @@ static state_run_t peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
|
||||
{
|
||||
char buffer[256] = { 0 };
|
||||
UINT16 pduLength, remain;
|
||||
if (!rdp_read_share_control_header(s, &pduLength, &remain, &pduType, &pduSource))
|
||||
if (!rdp_read_share_control_header(rdp, s, &pduLength, &remain, &pduType, &pduSource))
|
||||
return STATE_RUN_FAILED;
|
||||
|
||||
settings->PduSource = pduSource;
|
||||
@ -508,7 +509,7 @@ static state_run_t peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s)
|
||||
{
|
||||
if (!settings->UseRdpSecurityLayer)
|
||||
{
|
||||
if (!rdp_read_security_header(s, &securityFlags, NULL))
|
||||
if (!rdp_read_security_header(rdp, s, &securityFlags, NULL))
|
||||
return STATE_RUN_FAILED;
|
||||
}
|
||||
|
||||
@ -1505,8 +1506,6 @@ BOOL freerdp_peer_context_new_ex(freerdp_peer* client, const rdpSettings* settin
|
||||
rdpContext* context;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
rdp_log_build_warnings();
|
||||
|
||||
if (!client)
|
||||
return FALSE;
|
||||
|
||||
@ -1537,6 +1536,8 @@ BOOL freerdp_peer_context_new_ex(freerdp_peer* client, const rdpSettings* settin
|
||||
if (!(rdp = rdp_new(context)))
|
||||
goto fail;
|
||||
|
||||
rdp_log_build_warnings(rdp);
|
||||
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
client->update = rdp->update;
|
||||
client->settings = rdp->settings;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -202,16 +202,18 @@ struct rdp_rdp
|
||||
BOOL was_deactivated;
|
||||
UINT32 deactivated_width;
|
||||
UINT32 deactivated_height;
|
||||
|
||||
wLog* log;
|
||||
};
|
||||
|
||||
FREERDP_LOCAL BOOL rdp_read_security_header(wStream* s, UINT16* flags, UINT16* length);
|
||||
FREERDP_LOCAL BOOL rdp_write_security_header(wStream* s, UINT16 flags);
|
||||
FREERDP_LOCAL BOOL rdp_read_security_header(rdpRdp* rdp, wStream* s, UINT16* flags, UINT16* length);
|
||||
FREERDP_LOCAL BOOL rdp_write_security_header(rdpRdp* rdp, wStream* s, UINT16 flags);
|
||||
|
||||
FREERDP_LOCAL BOOL rdp_read_share_control_header(wStream* s, UINT16* tpktLength,
|
||||
FREERDP_LOCAL BOOL rdp_read_share_control_header(rdpRdp* rdp, wStream* s, UINT16* tpktLength,
|
||||
UINT16* remainingLength, UINT16* type,
|
||||
UINT16* channel_id);
|
||||
|
||||
FREERDP_LOCAL BOOL rdp_read_share_data_header(wStream* s, UINT16* length, BYTE* type,
|
||||
FREERDP_LOCAL BOOL rdp_read_share_data_header(rdpRdp* rdp, wStream* s, UINT16* length, BYTE* type,
|
||||
UINT32* share_id, BYTE* compressed_type,
|
||||
UINT16* compressed_len);
|
||||
|
||||
@ -259,11 +261,11 @@ FREERDP_LOCAL void* rdp_get_io_callback_context(rdpRdp* rdp);
|
||||
|
||||
#define RDP_TAG FREERDP_TAG("core.rdp")
|
||||
#ifdef WITH_DEBUG_RDP
|
||||
#define DEBUG_RDP(...) WLog_DBG(RDP_TAG, __VA_ARGS__)
|
||||
#define DEBUG_RDP(rdp, ...) WLog_Print(rdp->log, WLOG_DEBUG, __VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_RDP(...) \
|
||||
do \
|
||||
{ \
|
||||
#define DEBUG_RDP(rdp, ...) \
|
||||
do \
|
||||
{ \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
@ -291,6 +293,6 @@ const char* rdp_security_flag_string(UINT32 securityFlags, char* buffer, size_t
|
||||
BOOL rdp_set_backup_settings(rdpRdp* rdp);
|
||||
BOOL rdp_reset_runtime_settings(rdpRdp* rdp);
|
||||
|
||||
void rdp_log_build_warnings(void);
|
||||
void rdp_log_build_warnings(rdpRdp* rdp);
|
||||
|
||||
#endif /* FREERDP_LIB_CORE_RDP_H */
|
||||
|
Loading…
Reference in New Issue
Block a user