use new config file functions

ulab-original
jsorg71 17 years ago
parent 30492c0988
commit 792caad39a

@ -57,70 +57,64 @@ static tui8 g_unknown2[8] =
static int APP_CC static int APP_CC
xrdp_rdp_read_config(struct xrdp_client_info* client_info) xrdp_rdp_read_config(struct xrdp_client_info* client_info)
{ {
int fd;
int index; int index;
struct list* items; struct list* items;
struct list* values; struct list* values;
char* item; char* item;
char* value; char* value;
fd = g_file_open(XRDP_CFG_FILE); /* xrdp.ini */ items = list_create();
if (fd > 0) items->auto_free = 1;
values = list_create();
values->auto_free = 1;
file_by_name_read_section(XRDP_CFG_FILE, "globals", items, values);
for (index = 0; index < items->count; index++)
{ {
items = list_create(); item = (char*)list_get_item(items, index);
items->auto_free = 1; value = (char*)list_get_item(values, index);
values = list_create(); if (g_strcasecmp(item, "bitmap_cache") == 0)
values->auto_free = 1;
file_read_section(fd, "globals", items, values);
for (index = 0; index < items->count; index++)
{ {
item = (char*)list_get_item(items, index); if ((g_strcasecmp(value, "yes") == 0) ||
value = (char*)list_get_item(values, index); (g_strcasecmp(value, "true") == 0) ||
if (g_strncasecmp(item, "bitmap_cache", 255) == 0) (g_strcasecmp(value, "1") == 0))
{ {
if (g_strncasecmp(value, "yes", 255) == 0 || client_info->use_bitmap_cache = 1;
g_strncasecmp(value, "true", 255) == 0 ||
g_strncasecmp(value, "1", 255) == 0)
{
client_info->use_bitmap_cache = 1;
}
} }
else if (g_strncasecmp(item, "bitmap_compression", 255) == 0) }
else if (g_strcasecmp(item, "bitmap_compression") == 0)
{
if (g_strcasecmp(value, "yes") == 0 ||
g_strcasecmp(value, "true") == 0 ||
g_strcasecmp(value, "1") == 0)
{
client_info->use_bitmap_comp = 1;
}
}
else if (g_strcasecmp(item, "crypt_level") == 0)
{
if (g_strcasecmp(value, "low") == 0)
{
client_info->crypt_level = 1;
}
else if (g_strcasecmp(value, "medium") == 0)
{ {
if (g_strncasecmp(value, "yes", 255) == 0 || client_info->crypt_level = 2;
g_strncasecmp(value, "true", 255) == 0 ||
g_strncasecmp(value, "1", 255) == 0)
{
client_info->use_bitmap_comp = 1;
}
} }
else if (g_strncasecmp(item, "crypt_level", 255) == 0) else if (g_strcasecmp(value, "high") == 0)
{ {
if (g_strncasecmp(value, "low", 255) == 0) client_info->crypt_level = 3;
{
client_info->crypt_level = 1;
}
else if (g_strncasecmp(value, "medium", 255) == 0)
{
client_info->crypt_level = 2;
}
else if (g_strncasecmp(value, "high", 255) == 0)
{
client_info->crypt_level = 3;
}
} }
else if (g_strcasecmp(item, "channel_code") == 0) }
else if (g_strcasecmp(item, "channel_code") == 0)
{
if (g_strcasecmp(value, "1") == 0)
{ {
if (g_strcasecmp(value, "1") == 0) client_info->channel_code = 1;
{
client_info->channel_code = 1;
}
} }
} }
list_delete(items);
list_delete(values);
g_file_close(fd);
} }
list_delete(items);
list_delete(values);
return 0; return 0;
} }

@ -130,7 +130,6 @@ xrdp_sec_create(struct xrdp_rdp* owner, int sck, int crypt_level,
struct xrdp_sec* self; struct xrdp_sec* self;
struct list* items; struct list* items;
struct list* values; struct list* values;
int fd;
int index; int index;
char* item; char* item;
char* value; char* value;
@ -161,39 +160,34 @@ xrdp_sec_create(struct xrdp_rdp* owner, int sck, int crypt_level,
g_random(self->server_random, 32); g_random(self->server_random, 32);
self->mcs_layer = xrdp_mcs_create(self, sck, &self->client_mcs_data, self->mcs_layer = xrdp_mcs_create(self, sck, &self->client_mcs_data,
&self->server_mcs_data); &self->server_mcs_data);
fd = g_file_open(XRDP_KEY_FILE); /* rsakeys.ini */ items = list_create();
if (fd > 0) items->auto_free = 1;
{ values = list_create();
items = list_create(); values->auto_free = 1;
items->auto_free = 1; file_by_name_read_section(XRDP_KEY_FILE, "keys", items, values);
values = list_create(); for (index = 0; index < items->count; index++)
values->auto_free = 1; {
file_read_section(fd, "keys", items, values); item = (char*)list_get_item(items, index);
for (index = 0; index < items->count; index++) value = (char*)list_get_item(values, index);
if (g_strcasecmp(item, "pub_exp") == 0)
{ {
item = (char*)list_get_item(items, index); hex_str_to_bin(value, self->pub_exp, 4);
value = (char*)list_get_item(values, index); }
if (g_strncasecmp(item, "pub_exp", 255) == 0) else if (g_strcasecmp(item, "pub_mod") == 0)
{ {
hex_str_to_bin(value, self->pub_exp, 4); hex_str_to_bin(value, self->pub_mod, 64);
} }
else if (g_strncasecmp(item, "pub_mod", 255) == 0) else if (g_strcasecmp(item, "pub_sig") == 0)
{ {
hex_str_to_bin(value, self->pub_mod, 64); hex_str_to_bin(value, self->pub_sig, 64);
} }
else if (g_strncasecmp(item, "pub_sig", 255) == 0) else if (g_strcasecmp(item, "pri_exp") == 0)
{ {
hex_str_to_bin(value, self->pub_sig, 64); hex_str_to_bin(value, self->pri_exp, 64);
}
else if (g_strncasecmp(item, "pri_exp", 255) == 0)
{
hex_str_to_bin(value, self->pri_exp, 64);
}
} }
list_delete(items);
list_delete(values);
g_file_close(fd);
} }
list_delete(items);
list_delete(values);
self->chan_layer = xrdp_channel_create(self, self->mcs_layer); self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
DEBUG((" out xrdp_sec_create")); DEBUG((" out xrdp_sec_create"));
return self; return self;

Loading…
Cancel
Save