From 0566da74ebd6427a0e716a7a771209045f3dafe9 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 26 May 2012 19:00:14 -0700 Subject: [PATCH] xrdp: add fork option to xrdp.ini --- xrdp/xrdp.c | 13 +++---------- xrdp/xrdp.ini | 1 + xrdp/xrdp_listen.c | 11 +++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c index d88fd677..2975502e 100644 --- a/xrdp/xrdp.c +++ b/xrdp/xrdp.c @@ -25,7 +25,6 @@ static struct xrdp_listen* g_listen = 0; static long g_threadid = 0; /* main threadid */ -static int g_fork_not_thread = 0; static long g_sync_mutex = 0; static long g_sync1_mutex = 0; static tbus g_term_event = 0; @@ -45,14 +44,10 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1, long sync_result; int sync_command; - if (g_fork_not_thread) - { - /* always main thread, fork mode */ - sync_result = sync_func(sync_param1, sync_param2); - } - else if (tc_threadid_equal(tc_get_threadid(), g_threadid)) + if (tc_threadid_equal(tc_get_threadid(), g_threadid)) { /* this is the main thread, call the function directly */ + /* in fork mode, this always happens too */ sync_result = sync_func(sync_param1, sync_param2); } else @@ -98,7 +93,6 @@ xrdp_shutdown(int sig) void DEFAULT_CC xrdp_child(int sig) { - g_writeln("xrdp_child"); g_waitchild(); } @@ -250,8 +244,7 @@ xrdp_process_params(int argc, char** argv, (g_strncasecmp(option, "--fork", 255) == 0)) { startup_params->fork = 1; - g_fork_not_thread = 1; - g_writeln("running in fork mode"); + g_writeln("--fork parameter found, ini override"); } else { diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini index ee4652a9..af5f2650 100644 --- a/xrdp/xrdp.ini +++ b/xrdp/xrdp.ini @@ -6,6 +6,7 @@ port=3389 crypt_level=low channel_code=1 max_bpp=24 +fork=yes #black=000000 #grey=d6d3ce #dark_grey=808080 diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c index 36980b15..bbdd729a 100644 --- a/xrdp/xrdp_listen.c +++ b/xrdp/xrdp_listen.c @@ -174,6 +174,17 @@ xrdp_listen_get_port_address(char* port, int port_bytes, val = (char*)list_get_item(values, index); g_strncpy(address, val, address_bytes - 1); } + if (g_strcasecmp(val, "fork") == 0) + { + val = (char*)list_get_item(values, index); + if ((g_strcasecmp(val, "yes") == 0) || + (g_strcasecmp(val, "on") == 0) || + (g_strcasecmp(val, "true") == 0) || + (g_atoi(val) != 0)) + { + startup_param->fork = 1; + } + } } } }