slackbuilds/system/xrdp/xrdp-v0.6.1_cleanup-state.diff

52 lines
1.9 KiB
Diff

From fca088da8caab209534db2c6ff9dcda277a529a7 Mon Sep 17 00:00:00 2001
From: mancha <mancha1 AT zoho DOT com>
Date: Wed, 18 Feb 2015
Subject: Clean our state
Make sure our state is clean when we're at the login window. This
code, adapted from upstream's development branch, ensures settings
from previous connections are cleared.
---
xrdp/xrdp_mm.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -899,6 +899,25 @@ xrdp_mm_sesman_data_in(struct trans* tra
}
/*****************************************************************************/
+static void APP_CC
+cleanup_states(struct xrdp_mm *self)
+{
+ if (self != NULL)
+ {
+ self-> connected_state = 0; /* true if connected to sesman else false */
+ self-> sesman_trans = NULL; /* connection to sesman */
+ self-> sesman_trans_up = 0; /* true once connected to sesman */
+ self-> delete_sesman_trans = 0; /* boolean set when done with sesman connection */
+ self-> display = 0; /* 10 for :10.0, 11 for :11.0, etc */
+ self-> code = 0; /* 0 Xvnc session, 10 X11rdp session, 20 Xorg session */
+ self-> sesman_controlled = 0; /* true if this is a sesman session */
+ self-> chan_trans = NULL; /* connection to chansrv */
+ self-> chan_trans_up = 0; /* true once connected to chansrv */
+ self-> delete_chan_trans = 0; /* boolean set when done with channel connection */
+ }
+}
+
+/*****************************************************************************/
int APP_CC
xrdp_mm_connect(struct xrdp_mm* self)
{
@@ -916,6 +939,9 @@ xrdp_mm_connect(struct xrdp_mm* self)
char text[256];
char port[8];
+ /* make sure we start in correct state */
+ cleanup_states(self);
+
g_memset(ip,0,sizeof(char) * 256);
g_memset(errstr,0,sizeof(char) * 256);
g_memset(text,0,sizeof(char) * 256);