FreeRDP:
- replaced char* by const char* in function prototypes - MacFreeRDP: moved assignation of context function pointers - freerdp: added more pointer and return value validations to prevent crashes
This commit is contained in:
parent
a65bb78378
commit
c17c2f811b
@ -109,3 +109,8 @@
|
|||||||
#define PTR_FLAGS_BUTTON2 0x2000
|
#define PTR_FLAGS_BUTTON2 0x2000
|
||||||
#define PTR_FLAGS_BUTTON3 0x4000
|
#define PTR_FLAGS_BUTTON3 0x4000
|
||||||
#define WheelRotationMask 0x01FF
|
#define WheelRotationMask 0x01FF
|
||||||
|
|
||||||
|
BOOL mac_pre_connect(freerdp* instance);
|
||||||
|
BOOL mac_post_connect(freerdp* instance);
|
||||||
|
BOOL mac_authenticate(freerdp* instance, char** username, char** password, char** domain);
|
||||||
|
int mac_receive_channel_data(freerdp* instance, int chan_id, BYTE* data, int size, int flags, int total_size);
|
||||||
|
@ -75,9 +75,6 @@ void mf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
|
|||||||
void mf_Pointer_SetNull(rdpContext* context);
|
void mf_Pointer_SetNull(rdpContext* context);
|
||||||
void mf_Pointer_SetDefault(rdpContext* context);
|
void mf_Pointer_SetDefault(rdpContext* context);
|
||||||
// int rdp_connect(void);
|
// int rdp_connect(void);
|
||||||
BOOL mac_pre_connect(freerdp* instance);
|
|
||||||
BOOL mac_post_connect(freerdp* instance);
|
|
||||||
BOOL mac_authenticate(freerdp* instance, char** username, char** password, char** domain);
|
|
||||||
void mac_set_bounds(rdpContext* context, rdpBounds* bounds);
|
void mac_set_bounds(rdpContext* context, rdpBounds* bounds);
|
||||||
void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap);
|
void mac_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap);
|
||||||
void mac_begin_paint(rdpContext* context);
|
void mac_begin_paint(rdpContext* context);
|
||||||
@ -141,17 +138,7 @@ struct rgba_data
|
|||||||
e.handle = (void*) self;
|
e.handle = (void*) self;
|
||||||
PubSub_OnEmbedWindow(context->pubSub, context, &e);
|
PubSub_OnEmbedWindow(context->pubSub, context, &e);
|
||||||
|
|
||||||
context->instance->PreConnect = mac_pre_connect;
|
status = freerdp_connect(context->instance);
|
||||||
context->instance->PostConnect = mac_post_connect;
|
|
||||||
context->instance->ReceiveChannelData = mac_receive_channel_data;
|
|
||||||
context->instance->Authenticate = mac_authenticate;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// instance->Authenticate = mf_authenticate;
|
|
||||||
// instance->VerifyCertificate = mf_verify_certificate;
|
|
||||||
// instance->LogonErrorInfo = mf_logon_error_info;
|
|
||||||
|
|
||||||
status = freerdp_connect(context->instance);
|
|
||||||
|
|
||||||
if (!status)
|
if (!status)
|
||||||
{
|
{
|
||||||
@ -797,7 +784,6 @@ struct rgba_data
|
|||||||
NSLog(@"Exception: %@", e);
|
NSLog(@"Exception: %@", e);
|
||||||
}
|
}
|
||||||
@finally {
|
@finally {
|
||||||
NSLog(@"finally");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set client area to specified dimensions
|
// set client area to specified dimensions
|
||||||
|
@ -106,7 +106,12 @@ int mfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||||||
|
|
||||||
mfc = (mfContext*) instance->context;
|
mfc = (mfContext*) instance->context;
|
||||||
|
|
||||||
context->channels = freerdp_channels_new();
|
context->instance->PreConnect = mac_pre_connect;
|
||||||
|
context->instance->PostConnect = mac_post_connect;
|
||||||
|
context->instance->ReceiveChannelData = mac_receive_channel_data;
|
||||||
|
context->instance->Authenticate = mac_authenticate;
|
||||||
|
|
||||||
|
context->channels = freerdp_channels_new();
|
||||||
|
|
||||||
settings = instance->settings;
|
settings = instance->settings;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int freerdp_client_parse_connection_file(rdpContext* context, char* filename)
|
int freerdp_client_parse_connection_file(rdpContext* context, const char* filename)
|
||||||
{
|
{
|
||||||
rdpFile* file;
|
rdpFile* file;
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t si
|
|||||||
return freerdp_client_parse_rdp_file_buffer_ascii(file, buffer, size);
|
return freerdp_client_parse_rdp_file_buffer_ascii(file, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name)
|
BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name)
|
||||||
{
|
{
|
||||||
BYTE* buffer;
|
BYTE* buffer;
|
||||||
FILE* fp = NULL;
|
FILE* fp = NULL;
|
||||||
|
@ -84,7 +84,7 @@ FREERDP_API freerdp* freerdp_client_get_instance(rdpContext* context);
|
|||||||
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
|
FREERDP_API HANDLE freerdp_client_get_thread(rdpContext* context);
|
||||||
|
|
||||||
FREERDP_API int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv);
|
FREERDP_API int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv);
|
||||||
FREERDP_API int freerdp_client_parse_connection_file(rdpContext* context, char* filename);
|
FREERDP_API int freerdp_client_parse_connection_file(rdpContext* context, const char* filename);
|
||||||
FREERDP_API int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size);
|
FREERDP_API int freerdp_client_parse_connection_file_buffer(rdpContext* context, BYTE* buffer, size_t size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -137,7 +137,7 @@ typedef struct rdp_file rdpFile;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, char* name);
|
FREERDP_API BOOL freerdp_client_parse_rdp_file(rdpFile* file, const char* name);
|
||||||
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size);
|
FREERDP_API BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file, BYTE* buffer, size_t size);
|
||||||
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings);
|
FREERDP_API BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings* settings);
|
||||||
|
|
||||||
|
@ -77,15 +77,19 @@ BOOL rdp_client_connect(rdpRdp* rdp)
|
|||||||
|
|
||||||
if (settings->GatewayEnabled)
|
if (settings->GatewayEnabled)
|
||||||
{
|
{
|
||||||
char* user;
|
char* user;
|
||||||
char* domain;
|
char* domain;
|
||||||
char* cookie;
|
char* cookie;
|
||||||
int user_length;
|
int user_length = 0;
|
||||||
int domain_length;
|
int domain_length;
|
||||||
int cookie_length;
|
int cookie_length;
|
||||||
|
|
||||||
user = settings->Username;
|
|
||||||
user_length = strlen(settings->Username);
|
if (settings->Username)
|
||||||
|
{
|
||||||
|
user = settings->Username;
|
||||||
|
user_length = strlen(settings->Username);
|
||||||
|
}
|
||||||
|
|
||||||
if (settings->Domain)
|
if (settings->Domain)
|
||||||
domain = settings->Domain;
|
domain = settings->Domain;
|
||||||
@ -100,8 +104,11 @@ BOOL rdp_client_connect(rdpRdp* rdp)
|
|||||||
CopyMemory(cookie, domain, domain_length);
|
CopyMemory(cookie, domain, domain_length);
|
||||||
CharUpperBuffA(cookie, domain_length);
|
CharUpperBuffA(cookie, domain_length);
|
||||||
cookie[domain_length] = '\\';
|
cookie[domain_length] = '\\';
|
||||||
CopyMemory(&cookie[domain_length + 1], user, user_length);
|
|
||||||
cookie[cookie_length] = '\0';
|
if (settings->Username)
|
||||||
|
CopyMemory(&cookie[domain_length + 1], user, user_length);
|
||||||
|
|
||||||
|
cookie[cookie_length] = '\0';
|
||||||
|
|
||||||
nego_set_cookie(rdp->nego, cookie);
|
nego_set_cookie(rdp->nego, cookie);
|
||||||
free(cookie);
|
free(cookie);
|
||||||
|
@ -1369,6 +1369,10 @@ BOOL tsg_disconnect(rdpTsg* tsg)
|
|||||||
* | |
|
* | |
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (tsg == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
tsg->rpc->client->SynchronousReceive = TRUE;
|
tsg->rpc->client->SynchronousReceive = TRUE;
|
||||||
|
|
||||||
/* if we are already in state pending (i.e. if a server initiated disconnect was issued)
|
/* if we are already in state pending (i.e. if a server initiated disconnect was issued)
|
||||||
@ -1392,7 +1396,12 @@ BOOL tsg_disconnect(rdpTsg* tsg)
|
|||||||
int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
|
int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
|
||||||
{
|
{
|
||||||
int CopyLength;
|
int CopyLength;
|
||||||
rdpRpc* rpc = tsg->rpc;
|
rdpRpc* rpc;
|
||||||
|
|
||||||
|
if (tsg == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
rpc = tsg->rpc;
|
||||||
|
|
||||||
if (tsg->PendingPdu)
|
if (tsg->PendingPdu)
|
||||||
{
|
{
|
||||||
|
@ -210,6 +210,9 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAl
|
|||||||
return WAIT_FAILED;
|
return WAIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fd == -1)
|
||||||
|
return WAIT_FAILED;
|
||||||
|
|
||||||
FD_SET(fd, &fds);
|
FD_SET(fd, &fds);
|
||||||
|
|
||||||
if (fd > maxfd)
|
if (fd > maxfd)
|
||||||
|
Loading…
Reference in New Issue
Block a user