summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineering.com>2019-03-03 16:18:41 -0600
committerTimothy Pearson <tpearson@raptorengineering.com>2019-03-03 16:18:41 -0600
commite9bdf6466fddc44f54b64275b9eb1b8b5e5b5593 (patch)
treeaa45c2b7e7c274a511f998cf60b58c3b3beada34
parent5bfe503c1ff176683cf9b42848f12971204eda31 (diff)
downloadxrdp-proprietary-e9bdf6466fddc44f54b64275b9eb1b8b5e5b5593.tar.gz
xrdp-proprietary-e9bdf6466fddc44f54b64275b9eb1b8b5e5b5593.zip
Don't try connecting to remote node if preliminary node allocation has failed for any reason
-rw-r--r--sesman/session.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sesman/session.c b/sesman/session.c
index 31034057..3cdf475c 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -471,7 +471,7 @@ wait_for_remote_hostname(char* username)
/* wait up to 5 secs for hostname to appear */
i = 0;
const char * hostname = raptor_sm_get_hostname_for_username(username, false);
- while (strcmp(hostname, "") == 0)
+ while ((strcmp(hostname, "") == 0) || (strcmp(hostname, "ERROR") == 0))
{
g_free(hostname);
hostname = raptor_sm_get_hostname_for_username(username, false);
@@ -583,11 +583,18 @@ session_start_fork(int width, int height, int bpp, char* username,
else if (wmpid == 0) /* child (child sesman) xserver */
{
char* remote_server = wait_for_remote_hostname(username);
- wait_for_remote_xserver(remote_server, display);
- env_set_user(username, 0, display);
- //if (x_server_running(display))
- if (x_server_running_check_remote_ports(remote_server, display))
+ if ((strcmp(remote_server, "") == 0) || (strcmp(remote_server, "ERROR") == 0))
+ {
+ g_free(remote_server);
+ remote_server = NULL;
+ log_message(LOG_LEVEL_ERROR, "Unable to find available node for specified user / group. Check group mappings in database?\n");
+ }
+ else {
+ wait_for_remote_xserver(remote_server, display);
+ env_set_user(username, 0, display);
+ }
+ if (remote_server && x_server_running_check_remote_ports(remote_server, display))
{
g_free(remote_server);
@@ -688,6 +695,10 @@ session_start_fork(int width, int height, int bpp, char* username,
else
{
g_free(remote_server);
+ if (remote_server)
+ {
+ g_free(remote_server);
+ }
log_message( LOG_LEVEL_ERROR, "another Xserver is "
"already active on display %d", display);
}