libfreerdp-core: pad larger portion of rdpSettings

This commit is contained in:
Marc-André Moreau 2012-01-14 14:42:36 -05:00
parent 3f91e24a4d
commit 0c9db6a40a
7 changed files with 181 additions and 132 deletions

View File

@ -142,6 +142,39 @@ typedef struct
uint8 arcRandomBits[16];
} ARC_SC_PRIVATE_PACKET;
/* Certificates */
typedef struct rdp_certificate rdpCertificate;
struct rdp_CertBlob
{
uint32 length;
uint8* data;
};
typedef struct rdp_CertBlob rdpCertBlob;
struct rdp_X509CertChain
{
uint32 count;
rdpCertBlob* array;
};
typedef struct rdp_X509CertChain rdpX509CertChain;
struct rdp_CertInfo
{
rdpBlob modulus;
uint8 exponent[4];
};
typedef struct rdp_CertInfo rdpCertInfo;
struct rdp_certificate
{
rdpCertInfo cert_info;
rdpX509CertChain* x509_cert_chain;
};
/* Channels */
struct rdp_channel
{
char name[8]; /* ui sets */
@ -152,12 +185,16 @@ struct rdp_channel
};
typedef struct rdp_channel rdpChannel;
/* Extensions */
struct rdp_ext_set
{
char name[256]; /* plugin name or path */
void* data; /* plugin data */
};
/* Bitmap Cache */
struct _BITMAP_CACHE_CELL_INFO
{
uint16 numEntries;
@ -172,6 +209,8 @@ struct _BITMAP_CACHE_V2_CELL_INFO
};
typedef struct _BITMAP_CACHE_V2_CELL_INFO BITMAP_CACHE_V2_CELL_INFO;
/* Glyph Cache */
struct _GLYPH_CACHE_DEFINITION
{
uint16 cacheEntries;
@ -179,6 +218,8 @@ struct _GLYPH_CACHE_DEFINITION
};
typedef struct _GLYPH_CACHE_DEFINITION GLYPH_CACHE_DEFINITION;
/* Monitors */
struct rdp_monitor
{
int x;
@ -188,6 +229,8 @@ struct rdp_monitor
int is_primary;
};
/* Settings */
struct rdp_settings
{
void* instance; /* 0 */
@ -267,96 +310,111 @@ struct rdp_settings
boolean desktop_resize; /* 178 */
uint32 paddingH[192 - 179]; /* 179 */
boolean auto_reconnection;
ARC_CS_PRIVATE_PACKET client_auto_reconnect_cookie;
ARC_SC_PRIVATE_PACKET server_auto_reconnect_cookie;
/* Reconnection */
boolean auto_reconnection; /* 192 */
ARC_CS_PRIVATE_PACKET* client_auto_reconnect_cookie; /* 193 */
ARC_SC_PRIVATE_PACKET* server_auto_reconnect_cookie; /* 194 */
uint32 paddingI[208 - 195]; /* 195 */
/* Time Zone */
TIME_ZONE_INFO client_time_zone;
TIME_ZONE_INFO* client_time_zone; /* 208 */
uint32 paddingJ[216 - 209]; /* 209 */
/* Capabilities */
uint16 os_major_type;
uint16 os_minor_type;
uint32 vc_chunk_size;
boolean sound_beeps;
boolean smooth_fonts;
boolean frame_marker;
boolean fastpath_input;
boolean fastpath_output;
uint8 received_caps[32];
uint8 order_support[32];
boolean surface_commands;
boolean disable_wallpaper;
boolean disable_full_window_drag;
boolean disable_menu_animations;
boolean disable_theming;
uint32 connection_type;
uint32 multifrag_max_request_size;
uint32 os_major_type; /* 216 */
uint32 os_minor_type; /* 217 */
uint32 vc_chunk_size; /* 218 */
boolean sound_beeps; /* 219 */
boolean smooth_fonts; /* 220 */
boolean frame_marker; /* 221 */
boolean fastpath_input; /* 222 */
boolean fastpath_output; /* 223 */
uint8 received_caps[32]; /* 224 (8) */
uint8 order_support[32]; /* 232 (8) */
boolean surface_commands; /* 240 */
boolean disable_wallpaper; /* 241 */
boolean disable_full_window_drag; /* 242 */
boolean disable_menu_animations; /* 243 */
boolean disable_theming; /* 244 */
uint32 connection_type; /* 245 */
uint32 multifrag_max_request_size; /* 246 */
uint32 paddingK[248 - 247]; /* 247 */
/* Certificate */
char* cert_file;
char* privatekey_file;
char client_hostname[32];
char client_product_id[32];
rdpBlob server_random;
rdpBlob server_certificate;
boolean ignore_certificate;
struct rdp_certificate* server_cert;
char* cert_file; /* 248 */
char* privatekey_file; /* 249 */
char client_hostname[32]; /* 250 (8) */
char client_product_id[32]; /* 258 (8) */
rdpBlob* server_random; /* 266 */
rdpBlob* server_certificate; /* 267 */
boolean ignore_certificate; /* 268 */
rdpCertificate* server_cert; /* 269 */
uint32 paddingL[280 - 270]; /* 270 */
/* Codecs */
boolean rfx_codec;
boolean ns_codec;
uint32 rfx_codec_id;
uint32 ns_codec_id;
uint8 rfx_codec_mode;
boolean frame_acknowledge;
boolean rfx_codec; /* 280 */
boolean ns_codec; /* 281 */
uint32 rfx_codec_id; /* 282 */
uint32 ns_codec_id; /* 283 */
uint32 rfx_codec_mode; /* 284 */
boolean frame_acknowledge; /* 285 */
uint32 paddingM[296 - 286]; /* 286 */
/* Recording */
boolean dump_rfx;
boolean play_rfx;
char* dump_rfx_file;
char* play_rfx_file;
boolean dump_rfx; /* 296 */
boolean play_rfx; /* 297 */
char* dump_rfx_file; /* 298 */
char* play_rfx_file; /* 299 */
uint32 paddingN[312 - 300]; /* 300 */
/* RemoteApp */
boolean remote_app;
uint32 num_icon_caches;
uint32 num_icon_cache_entries;
boolean rail_langbar_supported;
boolean remote_app; /* 312 */
uint32 num_icon_caches; /* 313 */
uint32 num_icon_cache_entries; /* 314 */
boolean rail_langbar_supported; /* 315 */
uint32 paddingO[320 - 316]; /* 316 */
/* Pointer */
boolean large_pointer;
boolean color_pointer;
uint32 pointer_cache_size;
boolean large_pointer; /* 320 */
boolean color_pointer; /* 321 */
uint32 pointer_cache_size; /* 322 */
uint32 paddingP[328 - 323]; /* 323 */
/* Bitmap Cache */
boolean bitmap_cache;
boolean bitmap_cache_v3;
boolean persistent_bitmap_cache;
uint32 bitmapCacheV2NumCells;
BITMAP_CACHE_V2_CELL_INFO bitmapCacheV2CellInfo[6];
boolean bitmap_cache; /* 328 */
boolean bitmap_cache_v3; /* 329 */
boolean persistent_bitmap_cache; /* 330 */
uint32 bitmapCacheV2NumCells; /* 331 */
BITMAP_CACHE_V2_CELL_INFO* bitmapCacheV2CellInfo; /* 332 */
uint32 paddingQ[344 - 333]; /* 333 */
/* Offscreen Bitmap Cache */
boolean offscreen_bitmap_cache;
uint32 offscreen_bitmap_cache_size;
uint32 offscreen_bitmap_cache_entries;
boolean offscreen_bitmap_cache; /* 344 */
uint32 offscreen_bitmap_cache_size; /* 345 */
uint32 offscreen_bitmap_cache_entries; /* 346 */
uint32 paddingR[352 - 347]; /* 347 */
/* Glyph Cache */
boolean glyph_cache;
uint32 glyphSupportLevel;
GLYPH_CACHE_DEFINITION glyphCache[10];
GLYPH_CACHE_DEFINITION fragCache;
boolean glyph_cache; /* 352 */
uint32 glyphSupportLevel; /* 353 */
GLYPH_CACHE_DEFINITION* glyphCache; /* 354 */
GLYPH_CACHE_DEFINITION* fragCache; /* 355 */
uint32 paddingS[360 - 356]; /* 356 */
/* Draw Nine Grid */
boolean draw_nine_grid;
uint32 draw_nine_grid_cache_size;
uint32 draw_nine_grid_cache_entries;
boolean draw_nine_grid; /* 360 */
uint32 draw_nine_grid_cache_size; /* 361 */
uint32 draw_nine_grid_cache_entries; /* 362 */
uint32 paddingT[368 - 363]; /* 363 */
/* Draw GDI+ */
boolean draw_gdi_plus;
boolean draw_gdi_plus_cache;
boolean draw_gdi_plus; /* 368 */
boolean draw_gdi_plus_cache; /* 369 */
uint32 paddingU[376 - 370]; /* 370 */
/* Desktop Composition */
boolean desktop_composition;
boolean desktop_composition; /* 376 */
uint32 paddingV[384 - 377]; /* 377 */
/* Channels */
int num_channels;

View File

@ -861,18 +861,18 @@ void rdp_write_glyph_cache_capability_set(STREAM* s, rdpSettings* settings)
header = rdp_capability_set_start(s);
/* glyphCache (40 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[0]); /* glyphCache0 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[1]); /* glyphCache1 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[2]); /* glyphCache2 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[3]); /* glyphCache3 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[4]); /* glyphCache4 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[5]); /* glyphCache5 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[6]); /* glyphCache6 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[7]); /* glyphCache7 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[8]); /* glyphCache8 (4 bytes) */
rdp_write_cache_definition(s, &settings->glyphCache[9]); /* glyphCache9 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[0])); /* glyphCache0 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[1])); /* glyphCache1 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[2])); /* glyphCache2 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[3])); /* glyphCache3 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[4])); /* glyphCache4 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[5])); /* glyphCache5 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[6])); /* glyphCache6 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[7])); /* glyphCache7 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[8])); /* glyphCache8 (4 bytes) */
rdp_write_cache_definition(s, &(settings->glyphCache[9])); /* glyphCache9 (4 bytes) */
rdp_write_cache_definition(s, &settings->fragCache); /* fragCache (4 bytes) */
rdp_write_cache_definition(s, settings->fragCache); /* fragCache (4 bytes) */
stream_write_uint16(s, settings->glyphSupportLevel); /* glyphSupportLevel (2 bytes) */

View File

@ -20,12 +20,11 @@
#ifndef __CERTIFICATE_H
#define __CERTIFICATE_H
typedef struct rdp_certificate rdpCertificate;
#include "rdp.h"
#include "ber.h"
#include "crypto.h"
#include <freerdp/settings.h>
#include <freerdp/utils/blob.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/hexdump.h>
@ -37,35 +36,8 @@ typedef struct rdp_certificate rdpCertificate;
#define CERT_PERMANENTLY_ISSUED 0x00000000
#define CERT_TEMPORARILY_ISSUED 0x80000000
#define BB_RSA_KEY_BLOB 6
#define BB_RSA_SIGNATURE_BLOB 8
struct rdp_CertBlob
{
uint32 length;
uint8* data;
};
typedef struct rdp_CertBlob rdpCertBlob;
struct rdp_X509CertChain
{
uint32 count;
rdpCertBlob* array;
};
typedef struct rdp_X509CertChain rdpX509CertChain;
struct rdp_CertInfo
{
rdpBlob modulus;
uint8 exponent[4];
};
typedef struct rdp_CertInfo rdpCertInfo;
struct rdp_certificate
{
rdpCertInfo cert_info;
rdpX509CertChain* x509_cert_chain;
};
#define BB_RSA_KEY_BLOB 6
#define BB_RSA_SIGNATURE_BLOB 8
void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info);

View File

@ -770,10 +770,10 @@ void gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings)
{
uint8* data;
uint32 length;
uint32 serverRandomLen;
uint32 serverCertLen;
uint8* data;
uint32 len;
stream_read_uint32(s, settings->encryption_method); /* encryptionMethod */
stream_read_uint32(s, settings->encryption_level); /* encryptionLevel */
@ -793,8 +793,8 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings)
if (serverRandomLen > 0)
{
/* serverRandom */
freerdp_blob_alloc(&settings->server_random, serverRandomLen);
memcpy(settings->server_random.data, s->p, serverRandomLen);
freerdp_blob_alloc(settings->server_random, serverRandomLen);
memcpy(settings->server_random->data, s->p, serverRandomLen);
stream_seek(s, serverRandomLen);
}
else
@ -805,17 +805,16 @@ boolean gcc_read_server_security_data(STREAM* s, rdpSettings *settings)
if (serverCertLen > 0)
{
/* serverCertificate */
freerdp_blob_alloc(&settings->server_certificate, serverCertLen);
memcpy(settings->server_certificate.data, s->p, serverCertLen);
freerdp_blob_alloc(settings->server_certificate, serverCertLen);
memcpy(settings->server_certificate->data, s->p, serverCertLen);
stream_seek(s, serverCertLen);
certificate_free(settings->server_cert);
settings->server_cert = certificate_new();
data = settings->server_certificate.data;
len = settings->server_certificate.length;
if (!certificate_read_server_certificate(settings->server_cert, data, len))
{
data = settings->server_certificate->data;
length = settings->server_certificate->length;
if (!certificate_read_server_certificate(settings->server_cert, data, length))
return false;
}
}
else
{

View File

@ -86,7 +86,7 @@ void rdp_get_client_time_zone(STREAM* s, rdpSettings* settings)
time(&t);
local_time = localtime(&t);
clientTimeZone = &settings->client_time_zone;
clientTimeZone = settings->client_time_zone;
#if defined(sun)
if(local_time->tm_isdst > 0)
@ -134,7 +134,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings)
if (stream_get_left(s) < 172)
return false;
clientTimeZone = &settings->client_time_zone;
clientTimeZone = settings->client_time_zone;
stream_read_uint32(s, clientTimeZone->bias); /* Bias */
@ -176,12 +176,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
TIME_ZONE_INFO* clientTimeZone;
rdp_get_client_time_zone(s, settings);
clientTimeZone = &settings->client_time_zone;
clientTimeZone = settings->client_time_zone;
standardName = (uint8*)freerdp_uniconv_out(settings->uniconv, clientTimeZone->standardName, &length);
standardName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->standardName, &length);
standardNameLength = length;
daylightName = (uint8*)freerdp_uniconv_out(settings->uniconv, clientTimeZone->daylightName, &length);
daylightName = (uint8*) freerdp_uniconv_out(settings->uniconv, clientTimeZone->daylightName, &length);
daylightNameLength = length;
if (standardNameLength > 62)
@ -220,7 +220,7 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
void rdp_read_server_auto_reconnect_cookie(STREAM* s, rdpSettings* settings)
{
ARC_SC_PRIVATE_PACKET* autoReconnectCookie;
autoReconnectCookie = &settings->server_auto_reconnect_cookie;
autoReconnectCookie = settings->server_auto_reconnect_cookie;
stream_read_uint32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
stream_read_uint32(s, autoReconnectCookie->version); /* version (4 bytes) */
@ -238,7 +238,7 @@ void rdp_read_server_auto_reconnect_cookie(STREAM* s, rdpSettings* settings)
boolean rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings)
{
ARC_CS_PRIVATE_PACKET* autoReconnectCookie;
autoReconnectCookie = &settings->client_auto_reconnect_cookie;
autoReconnectCookie = settings->client_auto_reconnect_cookie;
if (stream_get_left(s) < 28)
return false;
@ -261,7 +261,7 @@ boolean rdp_read_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings)
void rdp_write_client_auto_reconnect_cookie(STREAM* s, rdpSettings* settings)
{
ARC_CS_PRIVATE_PACKET* autoReconnectCookie;
autoReconnectCookie = &settings->client_auto_reconnect_cookie;
autoReconnectCookie = settings->client_auto_reconnect_cookie;
stream_write_uint32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
stream_write_uint32(s, autoReconnectCookie->version); /* version (4 bytes) */
@ -336,13 +336,13 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings)
clientAddressFamily = settings->ipv6 ? ADDRESS_FAMILY_INET6 : ADDRESS_FAMILY_INET;
clientAddress = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->ip_address, &length);
clientAddress = (uint8*) freerdp_uniconv_out(settings->uniconv, settings->ip_address, &length);
cbClientAddress = length;
clientDir = (uint8*)freerdp_uniconv_out(settings->uniconv, settings->client_dir, &length);
clientDir = (uint8*) freerdp_uniconv_out(settings->uniconv, settings->client_dir, &length);
cbClientDir = length;
cbAutoReconnectLen = settings->client_auto_reconnect_cookie.cbLen;
cbAutoReconnectLen = settings->client_auto_reconnect_cookie->cbLen;
stream_write_uint16(s, clientAddressFamily); /* clientAddressFamily */

View File

@ -308,7 +308,7 @@ boolean security_establish_keys(uint8* client_random, rdpRdp* rdp)
rdpSettings* settings;
settings = rdp->settings;
server_random = settings->server_random.data;
server_random = settings->server_random->data;
if (settings->encryption_method == ENCRYPTION_METHOD_FIPS)
{

View File

@ -111,12 +111,15 @@ rdpSettings* settings_new(void* instance)
settings->bitmap_cache = true;
settings->persistent_bitmap_cache = false;
settings->bitmapCacheV2CellInfo = xzalloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6);
settings->refresh_rect = true;
settings->suppress_output = true;
settings->glyph_cache = true;
settings->glyphSupportLevel = GLYPH_SUPPORT_NONE;
settings->glyphCache = xzalloc(sizeof(GLYPH_CACHE_DEFINITION) * 10);
settings->fragCache = xnew(GLYPH_CACHE_DEFINITION);
settings->glyphCache[0].cacheEntries = 254;
settings->glyphCache[0].cacheMaximumCellSize = 4;
settings->glyphCache[1].cacheEntries = 254;
@ -137,8 +140,8 @@ rdpSettings* settings_new(void* instance)
settings->glyphCache[8].cacheMaximumCellSize = 256;
settings->glyphCache[9].cacheEntries = 64;
settings->glyphCache[9].cacheMaximumCellSize = 256;
settings->fragCache.cacheEntries = 256;
settings->fragCache.cacheMaximumCellSize = 256;
settings->fragCache->cacheEntries = 256;
settings->fragCache->cacheMaximumCellSize = 256;
settings->offscreen_bitmap_cache = true;
settings->offscreen_bitmap_cache_size = 7680;
@ -162,6 +165,14 @@ rdpSettings* settings_new(void* instance)
settings->uniconv = freerdp_uniconv_new();
gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1);
settings->mouse_motion = true;
settings->client_auto_reconnect_cookie = xnew(ARC_CS_PRIVATE_PACKET);
settings->server_auto_reconnect_cookie = xnew(ARC_SC_PRIVATE_PACKET);
settings->client_time_zone = xnew(TIME_ZONE_INFO);
settings->server_random = xnew(rdpBlob);
settings->server_certificate = xnew(rdpBlob);
}
return settings;
@ -182,8 +193,17 @@ void settings_free(rdpSettings* settings)
xfree(settings->client_dir);
xfree(settings->cert_file);
xfree(settings->privatekey_file);
freerdp_blob_free(&(settings->server_certificate));
freerdp_blob_free(settings->server_random);
freerdp_blob_free(settings->server_certificate);
xfree(settings->server_random);
xfree(settings->server_certificate);
certificate_free(settings->server_cert);
xfree(settings->client_auto_reconnect_cookie);
xfree(settings->server_auto_reconnect_cookie);
xfree(settings->client_time_zone);
xfree(settings->bitmapCacheV2CellInfo);
xfree(settings->glyphCache);
xfree(settings->fragCache);
xfree(settings);
}
}