mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
Fixed lots of compilation warnings and type mismatches
This commit is contained in:
parent
1af7ef2f1b
commit
5fb59a23a9
@ -1135,7 +1135,7 @@ static UINT rdpgfx_recv_cache_import_offer_pdu(RdpgfxServerContext* context, wSt
|
|||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < (pdu.cacheEntriesCount * 12))
|
if (Stream_GetRemainingLength(s) < (pdu.cacheEntriesCount * 12ULL))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "not enough data!");
|
WLog_ERR(TAG, "not enough data!");
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
|
@ -159,7 +159,7 @@ static UINT rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
|
|||||||
Stream_Seek_UINT8(s); /* bPad */
|
Stream_Seek_UINT8(s); /* bPad */
|
||||||
|
|
||||||
/* this check is only a guess as cbSize can influence the size of a format record */
|
/* this check is only a guess as cbSize can influence the size of a format record */
|
||||||
if (Stream_GetRemainingLength(s) < context->num_client_formats * 18)
|
if (Stream_GetRemainingLength(s) < context->num_client_formats * 18ULL)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "not enough data in stream!");
|
WLog_ERR(TAG, "not enough data in stream!");
|
||||||
return ERROR_INVALID_DATA;
|
return ERROR_INVALID_DATA;
|
||||||
|
@ -636,7 +636,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
|
|||||||
}
|
}
|
||||||
else if (instance->m_pFormatEtc[idx].cfFormat == RegisterClipboardFormat(CFSTR_FILECONTENTS))
|
else if (instance->m_pFormatEtc[idx].cfFormat == RegisterClipboardFormat(CFSTR_FILECONTENTS))
|
||||||
{
|
{
|
||||||
if (pFormatEtc->lindex < instance->m_nStreams)
|
if ((pFormatEtc->lindex >= 0) && ((ULONG)pFormatEtc->lindex < instance->m_nStreams))
|
||||||
{
|
{
|
||||||
pMedium->pstm = instance->m_pStream[pFormatEtc->lindex];
|
pMedium->pstm = instance->m_pStream[pFormatEtc->lindex];
|
||||||
IDataObject_AddRef(instance->m_pStream[pFormatEtc->lindex]);
|
IDataObject_AddRef(instance->m_pStream[pFormatEtc->lindex]);
|
||||||
@ -749,7 +749,6 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_EnumDAdvise(IDataObject* This
|
|||||||
static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* stgmed, ULONG count,
|
static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* stgmed, ULONG count,
|
||||||
void* data)
|
void* data)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
CliprdrDataObject* instance;
|
CliprdrDataObject* instance;
|
||||||
IDataObject* iDataObject;
|
IDataObject* iDataObject;
|
||||||
instance = (CliprdrDataObject*)calloc(1, sizeof(CliprdrDataObject));
|
instance = (CliprdrDataObject*)calloc(1, sizeof(CliprdrDataObject));
|
||||||
@ -783,6 +782,7 @@ static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* st
|
|||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
ULONG i;
|
||||||
instance->m_pFormatEtc = (FORMATETC*)calloc(count, sizeof(FORMATETC));
|
instance->m_pFormatEtc = (FORMATETC*)calloc(count, sizeof(FORMATETC));
|
||||||
|
|
||||||
if (!instance->m_pFormatEtc)
|
if (!instance->m_pFormatEtc)
|
||||||
|
@ -640,8 +640,8 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
|||||||
if (wParam == SYSCOMMAND_ID_SMARTSIZING)
|
if (wParam == SYSCOMMAND_ID_SMARTSIZING)
|
||||||
{
|
{
|
||||||
HMENU hMenu = GetSystemMenu(wfc->hwnd, FALSE);
|
HMENU hMenu = GetSystemMenu(wfc->hwnd, FALSE);
|
||||||
freerdp_set_param_bool(wfc->context.settings, FreeRDP_SmartSizing,
|
freerdp_settings_set_bool(wfc->context.settings, FreeRDP_SmartSizing,
|
||||||
!wfc->context.settings->SmartSizing);
|
!wfc->context.settings->SmartSizing);
|
||||||
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING,
|
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING,
|
||||||
wfc->context.settings->SmartSizing ? MF_CHECKED : MF_UNCHECKED);
|
wfc->context.settings->SmartSizing ? MF_CHECKED : MF_UNCHECKED);
|
||||||
}
|
}
|
||||||
|
@ -1164,8 +1164,10 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
|
|||||||
return (status == 0) ? TRUE : FALSE;
|
return (status == 0) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
|
#endif
|
||||||
static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* bufferSize,
|
static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* bufferSize,
|
||||||
const char* fmt, ...)
|
const char* fmt, ...)
|
||||||
{
|
{
|
||||||
@ -1208,7 +1210,9 @@ static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* buf
|
|||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, size_t size)
|
size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
#include <freerdp/codec/clear.h>
|
#include <freerdp/codec/clear.h>
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
||||||
|
#endif
|
||||||
/* [MS-RDPEGFX] 4.1.1.1 Example 1 */
|
/* [MS-RDPEGFX] 4.1.1.1 Example 1 */
|
||||||
static const BYTE PREPARE_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00";
|
static const BYTE PREPARE_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00";
|
||||||
static const BYTE TEST_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00";
|
static const BYTE TEST_CLEAR_EXAMPLE_1[] = "\x03\xc3\x11\x00";
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
/* [MS-RDPEGFX] 4.1.1.1 Example 2 */
|
/* [MS-RDPEGFX] 4.1.1.1 Example 2 */
|
||||||
static const BYTE TEST_CLEAR_EXAMPLE_2[] =
|
static const BYTE TEST_CLEAR_EXAMPLE_2[] =
|
||||||
|
@ -1123,7 +1123,11 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
|
|||||||
BYTE* buffer;
|
BYTE* buffer;
|
||||||
FILE* fp = NULL;
|
FILE* fp = NULL;
|
||||||
size_t readSize;
|
size_t readSize;
|
||||||
INT64 fileSize;
|
union
|
||||||
|
{
|
||||||
|
INT64 i64;
|
||||||
|
size_t s;
|
||||||
|
} fileSize;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
@ -1142,17 +1146,17 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
_fseeki64(fp, 0, SEEK_END);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
fileSize = _ftelli64(fp);
|
fileSize.i64 = _ftelli64(fp);
|
||||||
_fseeki64(fp, 0, SEEK_SET);
|
_fseeki64(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
if (fileSize < 1)
|
if (fileSize.i64 < 1)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name);
|
WLog_ERR(TAG, "Failed to read ASSISTANCE file %s ", name);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = (BYTE*)malloc(fileSize + 2);
|
buffer = (BYTE*)malloc(fileSize.s + 2);
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
@ -1160,12 +1164,12 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
readSize = fread(buffer, fileSize, 1, fp);
|
readSize = fread(buffer, fileSize.s, 1, fp);
|
||||||
|
|
||||||
if (!readSize)
|
if (!readSize)
|
||||||
{
|
{
|
||||||
if (!ferror(fp))
|
if (!ferror(fp))
|
||||||
readSize = fileSize;
|
readSize = fileSize.s;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -1178,9 +1182,9 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[fileSize] = '\0';
|
buffer[fileSize.s] = '\0';
|
||||||
buffer[fileSize + 1] = '\0';
|
buffer[fileSize.s + 1] = '\0';
|
||||||
status = freerdp_assistance_parse_file_buffer(file, (char*)buffer, fileSize, password);
|
status = freerdp_assistance_parse_file_buffer(file, (char*)buffer, fileSize.s, password);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,16 @@ static const char TEST_MSRC_INCIDENT_FILE_TYPE1[] =
|
|||||||
"L=\"0\" />"
|
"L=\"0\" />"
|
||||||
"</UPLOADINFO>";
|
"</UPLOADINFO>";
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
#pragma GCC diagnostic ignored "-Wunused-const-variable"
|
||||||
|
#endif
|
||||||
static const BYTE TEST_MSRC_INCIDENT_EXPERT_BLOB_TYPE1[32] =
|
static const BYTE TEST_MSRC_INCIDENT_EXPERT_BLOB_TYPE1[32] =
|
||||||
"\x3C\x9C\xAE\x0B\xCE\x7A\xB1\x5C\x8A\xAC\x01\xD6\x76\x04\x5E\xDF"
|
"\x3C\x9C\xAE\x0B\xCE\x7A\xB1\x5C\x8A\xAC\x01\xD6\x76\x04\x5E\xDF"
|
||||||
"\x3F\xFA\xF0\x92\xE2\xDE\x36\x8A\x20\x17\xE6\x8A\x0D\xED\x7C\x90";
|
"\x3F\xFA\xF0\x92\xE2\xDE\x36\x8A\x20\x17\xE6\x8A\x0D\xED\x7C\x90";
|
||||||
|
#if __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char TEST_MSRC_INCIDENT_PASSWORD_TYPE2[] = "48BJQ853X3B4";
|
static const char TEST_MSRC_INCIDENT_PASSWORD_TYPE2[] = "48BJQ853X3B4";
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/crypto.h>
|
#include <winpr/crypto.h>
|
||||||
|
#include <winpr/assert.h>
|
||||||
|
|
||||||
#include "autodetect.h"
|
#include "autodetect.h"
|
||||||
|
|
||||||
@ -305,14 +306,15 @@ static BOOL autodetect_send_bandwidth_measure_results(rdpRdp* rdp, UINT16 respon
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
WLog_VRB(AUTODETECT_TAG,
|
WLog_VRB(AUTODETECT_TAG,
|
||||||
"sending Bandwidth Measure Results PDU -> timeDelta=%" PRIu32 ", byteCount=%" PRIu32
|
"sending Bandwidth Measure Results PDU -> timeDelta=%" PRIu64 ", byteCount=%" PRIu32
|
||||||
"",
|
"",
|
||||||
timeDelta, rdp->autodetect->bandwidthMeasureByteCount);
|
timeDelta, rdp->autodetect->bandwidthMeasureByteCount);
|
||||||
|
|
||||||
Stream_Write_UINT8(s, 0x0E); /* headerLength (1 byte) */
|
Stream_Write_UINT8(s, 0x0E); /* headerLength (1 byte) */
|
||||||
Stream_Write_UINT8(s, TYPE_ID_AUTODETECT_RESPONSE); /* headerTypeId (1 byte) */
|
Stream_Write_UINT8(s, TYPE_ID_AUTODETECT_RESPONSE); /* headerTypeId (1 byte) */
|
||||||
Stream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */
|
Stream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */
|
||||||
Stream_Write_UINT16(s, responseType); /* responseType (1 byte) */
|
Stream_Write_UINT16(s, responseType); /* responseType (1 byte) */
|
||||||
Stream_Write_UINT32(s, timeDelta); /* timeDelta (4 bytes) */
|
Stream_Write_UINT32(s, (UINT32)MIN(timeDelta, UINT32_MAX)); /* timeDelta (4 bytes) */
|
||||||
Stream_Write_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */
|
Stream_Write_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */
|
||||||
IFCALLRET(rdp->autodetect->ClientBandwidthMeasureResult, success, rdp->context,
|
IFCALLRET(rdp->autodetect->ClientBandwidthMeasureResult, success, rdp->context,
|
||||||
rdp->autodetect);
|
rdp->autodetect);
|
||||||
@ -400,7 +402,8 @@ static BOOL autodetect_recv_rtt_measure_response(rdpRdp* rdp, wStream* s,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
WLog_VRB(AUTODETECT_TAG, "received RTT Measure Response PDU");
|
WLog_VRB(AUTODETECT_TAG, "received RTT Measure Response PDU");
|
||||||
rdp->autodetect->netCharAverageRTT = GetTickCount64() - rdp->autodetect->rttMeasureStartTime;
|
rdp->autodetect->netCharAverageRTT =
|
||||||
|
(UINT32)MIN(GetTickCount64() - rdp->autodetect->rttMeasureStartTime, UINT32_MAX);
|
||||||
|
|
||||||
if (rdp->autodetect->netCharBaseRTT == 0 ||
|
if (rdp->autodetect->netCharBaseRTT == 0 ||
|
||||||
rdp->autodetect->netCharBaseRTT > rdp->autodetect->netCharAverageRTT)
|
rdp->autodetect->netCharBaseRTT > rdp->autodetect->netCharAverageRTT)
|
||||||
@ -514,8 +517,10 @@ static BOOL autodetect_recv_bandwidth_measure_results(rdpRdp* rdp, wStream* s,
|
|||||||
Stream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */
|
Stream_Read_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */
|
||||||
|
|
||||||
if (rdp->autodetect->bandwidthMeasureTimeDelta > 0)
|
if (rdp->autodetect->bandwidthMeasureTimeDelta > 0)
|
||||||
rdp->autodetect->netCharBandwidth = rdp->autodetect->bandwidthMeasureByteCount * 8 /
|
rdp->autodetect->netCharBandwidth =
|
||||||
rdp->autodetect->bandwidthMeasureTimeDelta;
|
(UINT32)MIN(rdp->autodetect->bandwidthMeasureByteCount * 8ULL /
|
||||||
|
rdp->autodetect->bandwidthMeasureTimeDelta,
|
||||||
|
UINT32_MAX);
|
||||||
else
|
else
|
||||||
rdp->autodetect->netCharBandwidth = 0;
|
rdp->autodetect->netCharBandwidth = 0;
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ BOOL rpc_ncacn_http_ntlm_init(rdpContext* context, RpcChannel* channel)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ntlm_client_make_spn(ntlm, _T("HTTP"), settings->GatewayHostname))
|
if (!ntlm_client_make_spn(ntlm, "HTTP", settings->GatewayHostname))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ static ULONG cast_from_size_(size_t size, const char* fkt, const char* file, int
|
|||||||
|
|
||||||
#define cast_from_size(size) cast_from_size_(size, __FUNCTION__, __FILE__, __LINE__)
|
#define cast_from_size(size) cast_from_size_(size, __FUNCTION__, __FILE__, __LINE__)
|
||||||
|
|
||||||
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, LPCTSTR user, LPCTSTR domain, LPCTSTR password,
|
BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, LPCSTR user, LPCSTR domain, LPCSTR password,
|
||||||
SecPkgContext_Bindings* Bindings)
|
SecPkgContext_Bindings* Bindings)
|
||||||
{
|
{
|
||||||
SECURITY_STATUS status;
|
SECURITY_STATUS status;
|
||||||
@ -135,15 +135,15 @@ BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, LPCTSTR user, LPCTSTR domain, LP
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCTSTR ServiceClass, LPCTSTR hostname)
|
BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCSTR ServiceClass, LPCSTR hostname)
|
||||||
{
|
{
|
||||||
BOOL status = FALSE;
|
BOOL status = FALSE;
|
||||||
DWORD SpnLength = 0;
|
DWORD SpnLength = 0;
|
||||||
LPTSTR hostnameX = NULL;
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
|
LPWSTR hostnameX = NULL;
|
||||||
ConvertToUnicode(CP_UTF8, 0, hostname, -1, (LPWSTR*)&hostnameX, 0);
|
ConvertToUnicode(CP_UTF8, 0, hostname, -1, (LPWSTR*)&hostnameX, 0);
|
||||||
#else
|
#else
|
||||||
hostnameX = _strdup(hostname);
|
LPCSTR hostnameX = _strdup(hostname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!hostnameX)
|
if (!hostnameX)
|
||||||
|
@ -33,11 +33,10 @@ FREERDP_LOCAL void ntlm_free(rdpNtlm* ntlm);
|
|||||||
|
|
||||||
FREERDP_LOCAL BOOL ntlm_authenticate(rdpNtlm* ntlm, BOOL* pbContinueNeeded);
|
FREERDP_LOCAL BOOL ntlm_authenticate(rdpNtlm* ntlm, BOOL* pbContinueNeeded);
|
||||||
|
|
||||||
FREERDP_LOCAL BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, LPCTSTR user,
|
FREERDP_LOCAL BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL confidentiality, LPCSTR user, LPCSTR domain,
|
||||||
LPCTSTR domain, LPCTSTR password,
|
LPCSTR password, SecPkgContext_Bindings* Bindings);
|
||||||
SecPkgContext_Bindings* Bindings);
|
|
||||||
|
|
||||||
FREERDP_LOCAL BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCTSTR ServiceClass, LPCTSTR hostname);
|
FREERDP_LOCAL BOOL ntlm_client_make_spn(rdpNtlm* ntlm, LPCSTR ServiceClass, LPCSTR hostname);
|
||||||
|
|
||||||
FREERDP_LOCAL SSIZE_T ntlm_client_query_auth_size(rdpNtlm* ntlm);
|
FREERDP_LOCAL SSIZE_T ntlm_client_query_auth_size(rdpNtlm* ntlm);
|
||||||
FREERDP_LOCAL SSIZE_T ntlm_client_get_context_max_size(rdpNtlm* ntlm);
|
FREERDP_LOCAL SSIZE_T ntlm_client_get_context_max_size(rdpNtlm* ntlm);
|
||||||
|
@ -1633,7 +1633,7 @@ static BOOL rdg_ntlm_init(rdpRdg* rdg, rdpTls* tls)
|
|||||||
settings->GatewayPassword, tls->Bindings))
|
settings->GatewayPassword, tls->Bindings))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!ntlm_client_make_spn(rdg->ntlm, _T("HTTP"), settings->GatewayHostname))
|
if (!ntlm_client_make_spn(rdg->ntlm, "HTTP", settings->GatewayHostname))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!ntlm_authenticate(rdg->ntlm, &continueNeeded))
|
if (!ntlm_authenticate(rdg->ntlm, &continueNeeded))
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/assert.h>
|
||||||
|
|
||||||
#include <freerdp/input.h>
|
#include <freerdp/input.h>
|
||||||
#include <freerdp/log.h>
|
#include <freerdp/log.h>
|
||||||
@ -299,7 +300,8 @@ static BOOL input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UI
|
|||||||
if (!s)
|
if (!s)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Stream_Write_UINT8(s, code); /* keyCode (1 byte) */
|
WINPR_ASSERT(code <= UINT8_MAX);
|
||||||
|
Stream_Write_UINT8(s, (UINT8)code); /* keyCode (1 byte) */
|
||||||
return fastpath_send_input_pdu(rdp->fastpath, s);
|
return fastpath_send_input_pdu(rdp->fastpath, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ static BYTE* loadCalFile(rdpSettings* settings, const char* hostname, size_t* da
|
|||||||
char *licenseStorePath = NULL, *calPath = NULL;
|
char *licenseStorePath = NULL, *calPath = NULL;
|
||||||
char calFilename[MAX_PATH];
|
char calFilename[MAX_PATH];
|
||||||
char hash[41];
|
char hash[41];
|
||||||
size_t length;
|
INT64 length;
|
||||||
int status;
|
int status;
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
BYTE* ret = NULL;
|
BYTE* ret = NULL;
|
||||||
@ -294,16 +294,18 @@ static BYTE* loadCalFile(rdpSettings* settings, const char* hostname, size_t* da
|
|||||||
_fseeki64(fp, 0, SEEK_END);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
length = _ftelli64(fp);
|
length = _ftelli64(fp);
|
||||||
_fseeki64(fp, 0, SEEK_SET);
|
_fseeki64(fp, 0, SEEK_SET);
|
||||||
|
if (length < 0)
|
||||||
|
goto error_malloc;
|
||||||
|
|
||||||
ret = (BYTE*)malloc(length);
|
ret = (BYTE*)malloc((size_t)length);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
goto error_malloc;
|
goto error_malloc;
|
||||||
|
|
||||||
status = fread(ret, length, 1, fp);
|
status = fread(ret, (size_t)length, 1, fp);
|
||||||
if (status <= 0)
|
if (status <= 0)
|
||||||
goto error_read;
|
goto error_read;
|
||||||
|
|
||||||
*dataLen = length;
|
*dataLen = (size_t)length;
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(calPath);
|
free(calPath);
|
||||||
|
@ -343,7 +343,7 @@ BOOL proxy_parse_uri(rdpSettings* settings, const char* uri_in)
|
|||||||
if ((errno != 0) || (val <= 0) || (val > UINT16_MAX))
|
if ((errno != 0) || (val <= 0) || (val > UINT16_MAX))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
port = val;
|
port = (UINT16)val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1213,7 +1213,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, UINT16* pLength, UINT16 securityFlags)
|
|||||||
length -= 12;
|
length -= 12;
|
||||||
padLength = length - pad;
|
padLength = length - pad;
|
||||||
|
|
||||||
if ((length <= 0) || (padLength <= 0))
|
if ((length <= 0) || (padLength <= 0) || (padLength > UINT16_MAX))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!security_fips_decrypt(Stream_Pointer(s), length, rdp))
|
if (!security_fips_decrypt(Stream_Pointer(s), length, rdp))
|
||||||
@ -1229,7 +1229,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, UINT16* pLength, UINT16 securityFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stream_SetLength(s, Stream_Length(s) - pad);
|
Stream_SetLength(s, Stream_Length(s) - pad);
|
||||||
*pLength = padLength;
|
*pLength = (UINT16)padLength;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,10 +192,15 @@ static BOOL update_write_surfcmd_bitmap_ex(wStream* s, const TS_BITMAP_DATA_EX*
|
|||||||
if (!Stream_EnsureRemainingCapacity(s, 12))
|
if (!Stream_EnsureRemainingCapacity(s, 12))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (bmp->codecID > UINT8_MAX)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "Invalid TS_BITMAP_DATA_EX::codecID=0x%04" PRIx16 "", bmp->codecID);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
Stream_Write_UINT8(s, bmp->bpp);
|
Stream_Write_UINT8(s, bmp->bpp);
|
||||||
Stream_Write_UINT8(s, bmp->flags);
|
Stream_Write_UINT8(s, bmp->flags);
|
||||||
Stream_Write_UINT8(s, 0); /* reserved1, reserved2 */
|
Stream_Write_UINT8(s, 0); /* reserved1, reserved2 */
|
||||||
Stream_Write_UINT8(s, bmp->codecID);
|
Stream_Write_UINT8(s, (UINT8)bmp->codecID);
|
||||||
Stream_Write_UINT16(s, bmp->width);
|
Stream_Write_UINT16(s, bmp->width);
|
||||||
Stream_Write_UINT16(s, bmp->height);
|
Stream_Write_UINT16(s, bmp->height);
|
||||||
Stream_Write_UINT32(s, bmp->bitmapDataLength);
|
Stream_Write_UINT32(s, bmp->bitmapDataLength);
|
||||||
|
@ -320,13 +320,15 @@ static char* crypto_print_name(X509_NAME* name)
|
|||||||
|
|
||||||
if (X509_NAME_print_ex(outBIO, name, 0, XN_FLAG_ONELINE) > 0)
|
if (X509_NAME_print_ex(outBIO, name, 0, XN_FLAG_ONELINE) > 0)
|
||||||
{
|
{
|
||||||
unsigned long size = BIO_number_written(outBIO);
|
UINT64 size = BIO_number_written(outBIO);
|
||||||
buffer = calloc(1, size + 1);
|
if (size > INT_MAX)
|
||||||
|
return NULL;
|
||||||
|
buffer = calloc(1, (size_t)size + 1);
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
BIO_read(outBIO, buffer, size);
|
BIO_read(outBIO, buffer, (int)size);
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_free_all(outBIO);
|
BIO_free_all(outBIO);
|
||||||
|
@ -75,7 +75,7 @@ BOOL per_write_length(wStream* s, UINT16 length)
|
|||||||
{
|
{
|
||||||
if (!Stream_EnsureRemainingCapacity(s, 1))
|
if (!Stream_EnsureRemainingCapacity(s, 1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
Stream_Write_UINT8(s, length);
|
Stream_Write_UINT8(s, (UINT8)length);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ int main(int argc, char* argv[])
|
|||||||
// first the args that will cause the program to terminate
|
// first the args that will cause the program to terminate
|
||||||
if (strcmp("--list-screens", argv[index]) == 0)
|
if (strcmp("--list-screens", argv[index]) == 0)
|
||||||
{
|
{
|
||||||
_TCHAR name[128];
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int bpp;
|
int bpp;
|
||||||
@ -72,7 +71,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
for (i = 0;; i++)
|
for (i = 0;; i++)
|
||||||
{
|
{
|
||||||
if (get_screen_info(i, name, &width, &height, &bpp) != 0)
|
_TCHAR name[128] = { 0 };
|
||||||
|
if (get_screen_info(i, name, ARRAYSIZE(name), &width, &height, &bpp) != 0)
|
||||||
{
|
{
|
||||||
if ((width * height * bpp) == 0)
|
if ((width * height * bpp) == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -135,7 +135,6 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
if (screen_selected == FALSE)
|
if (screen_selected == FALSE)
|
||||||
{
|
{
|
||||||
_TCHAR name[128];
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int bpp;
|
int bpp;
|
||||||
@ -146,7 +145,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
for (i = 0;; i++)
|
for (i = 0;; i++)
|
||||||
{
|
{
|
||||||
if (get_screen_info(i, name, &width, &height, &bpp) != 0)
|
_TCHAR name[128] = { 0 };
|
||||||
|
if (get_screen_info(i, name, ARRAYSIZE(name), &width, &height, &bpp) != 0)
|
||||||
{
|
{
|
||||||
if ((width * height * bpp) == 0)
|
if ((width * height * bpp) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -43,13 +43,12 @@
|
|||||||
|
|
||||||
#define SERVER_KEY "Software\\" FREERDP_VENDOR_STRING "\\" FREERDP_PRODUCT_STRING "\\Server"
|
#define SERVER_KEY "Software\\" FREERDP_VENDOR_STRING "\\" FREERDP_PRODUCT_STRING "\\Server"
|
||||||
|
|
||||||
cbCallback cbEvent;
|
static cbCallback cbEvent = NULL;
|
||||||
|
|
||||||
int get_screen_info(int id, _TCHAR* name, int* width, int* height, int* bpp)
|
int get_screen_info(int id, _TCHAR* name, size_t length, int* width, int* height, int* bpp)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE dd;
|
DISPLAY_DEVICE dd = { 0 };
|
||||||
|
|
||||||
memset(&dd, 0, sizeof(DISPLAY_DEVICE));
|
|
||||||
dd.cb = sizeof(DISPLAY_DEVICE);
|
dd.cb = sizeof(DISPLAY_DEVICE);
|
||||||
|
|
||||||
if (EnumDisplayDevices(NULL, id, &dd, 0) != 0)
|
if (EnumDisplayDevices(NULL, id, &dd, 0) != 0)
|
||||||
@ -57,7 +56,7 @@ int get_screen_info(int id, _TCHAR* name, int* width, int* height, int* bpp)
|
|||||||
HDC dc;
|
HDC dc;
|
||||||
|
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
_stprintf(name, _T("%s (%s)"), dd.DeviceName, dd.DeviceString);
|
_stprintf_s(name, length, _T("%s (%s)"), dd.DeviceName, dd.DeviceString);
|
||||||
|
|
||||||
dc = CreateDC(dd.DeviceName, NULL, NULL, NULL);
|
dc = CreateDC(dd.DeviceName, NULL, NULL, NULL);
|
||||||
*width = GetDeviceCaps(dc, HORZRES);
|
*width = GetDeviceCaps(dc, HORZRES);
|
||||||
|
@ -115,7 +115,7 @@ typedef struct wf_server wfServer;
|
|||||||
|
|
||||||
typedef void(__stdcall* cbCallback)(int, UINT32);
|
typedef void(__stdcall* cbCallback)(int, UINT32);
|
||||||
|
|
||||||
FREERDP_API int get_screen_info(int id, _TCHAR* name, int* w, int* h, int* b);
|
FREERDP_API int get_screen_info(int id, _TCHAR* name, size_t length, int* w, int* h, int* b);
|
||||||
FREERDP_API void set_screen_id(int id);
|
FREERDP_API void set_screen_id(int id);
|
||||||
|
|
||||||
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
|
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
|
||||||
|
@ -97,7 +97,7 @@ static BOOL wf_peer_post_connect(freerdp_peer* client)
|
|||||||
wfi = context->info;
|
wfi = context->info;
|
||||||
settings = client->settings;
|
settings = client->settings;
|
||||||
|
|
||||||
if ((get_screen_info(wfi->screenID, NULL, &wfi->servscreen_width, &wfi->servscreen_height,
|
if ((get_screen_info(wfi->screenID, NULL, 0, &wfi->servscreen_width, &wfi->servscreen_height,
|
||||||
&wfi->bitsPerPixel) == 0) ||
|
&wfi->bitsPerPixel) == 0) ||
|
||||||
(wfi->servscreen_width == 0) || (wfi->servscreen_height == 0) || (wfi->bitsPerPixel == 0))
|
(wfi->servscreen_width == 0) || (wfi->servscreen_height == 0) || (wfi->bitsPerPixel == 0))
|
||||||
{
|
{
|
||||||
|
@ -46,13 +46,14 @@
|
|||||||
static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
|
static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
|
||||||
{
|
{
|
||||||
wfInfo* wfi;
|
wfInfo* wfi;
|
||||||
int i, j;
|
size_t i;
|
||||||
wfi = wf_info_get_instance();
|
wfi = wf_info_get_instance();
|
||||||
wfi->agreed_format = NULL;
|
wfi->agreed_format = NULL;
|
||||||
WLog_DBG(TAG, "Client supports the following %d formats:", context->num_client_formats);
|
WLog_DBG(TAG, "Client supports the following %d formats:", context->num_client_formats);
|
||||||
|
|
||||||
for (i = 0; i < context->num_client_formats; i++)
|
for (i = 0; i < context->num_client_formats; i++)
|
||||||
{
|
{
|
||||||
|
size_t j;
|
||||||
// TODO: improve the way we agree on a format
|
// TODO: improve the way we agree on a format
|
||||||
for (j = 0; j < context->num_server_formats; j++)
|
for (j = 0; j < context->num_server_formats; j++)
|
||||||
{
|
{
|
||||||
|
@ -104,8 +104,8 @@ static DWORD shw_verify_certificate(freerdp* instance, const char* common_name,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shw_verify_x509_certificate(freerdp* instance, BYTE* data, int length,
|
static int shw_verify_x509_certificate(freerdp* instance, const BYTE* data, size_t length,
|
||||||
const char* hostname, int port, DWORD flags)
|
const char* hostname, UINT16 port, DWORD flags)
|
||||||
{
|
{
|
||||||
WLog_WARN(TAG, "Certificate checks not implemented, access granted to everyone!");
|
WLog_WARN(TAG, "Certificate checks not implemented, access granted to everyone!");
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user