Add support for SCP_SESSION_TYPE_RESIZEABLE_VNC

This commit is contained in:
matt335672 2019-04-11 15:24:26 +01:00
parent 3293370faf
commit 7d305b0085
10 changed files with 49 additions and 17 deletions

View File

@ -63,6 +63,10 @@ scp_session_set_type(struct SCP_SESSION *s, tui8 type)
s->type = SCP_SESSION_TYPE_XVNC; s->type = SCP_SESSION_TYPE_XVNC;
break; break;
case SCP_SESSION_TYPE_RESIZABLE_XVNC:
s->type = SCP_SESSION_TYPE_RESIZABLE_XVNC;
break;
case SCP_SESSION_TYPE_XRDP: case SCP_SESSION_TYPE_XRDP:
s->type = SCP_SESSION_TYPE_XRDP; s->type = SCP_SESSION_TYPE_XRDP;
break; break;

View File

@ -47,6 +47,7 @@
* XRDP sends this command to let sesman verify if the user is allowed * XRDP sends this command to let sesman verify if the user is allowed
* to use the gateway */ * to use the gateway */
#define SCP_GW_AUTHENTICATION 0x04 #define SCP_GW_AUTHENTICATION 0x04
#define SCP_SESSION_TYPE_RESIZABLE_XVNC 0x05
#define SCP_ADDRESS_TYPE_IPV4 0x00 #define SCP_ADDRESS_TYPE_IPV4 0x00
#define SCP_ADDRESS_TYPE_IPV6 0x01 #define SCP_ADDRESS_TYPE_IPV6 0x01

View File

@ -56,6 +56,10 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
{ {
out_uint16_be(c->out_s, 0); out_uint16_be(c->out_s, 0);
} }
else if (s->type == SCP_SESSION_TYPE_RESIZABLE_XVNC)
{
out_uint16_be(c->out_s, 1);
}
else if (s->type == SCP_SESSION_TYPE_XRDP) else if (s->type == SCP_SESSION_TYPE_XRDP)
{ {
out_uint16_be(c->out_s, 10); out_uint16_be(c->out_s, 10);
@ -199,7 +203,7 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk)
in_uint16_be(c->in_s, code); in_uint16_be(c->in_s, code);
if (code == 0 || code == 10 || code == 20) if (code == 0 || code == 1 || code == 10 || code == 20)
{ {
session = scp_session_create(); session = scp_session_create();
@ -215,6 +219,10 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk)
{ {
scp_session_set_type(session, SCP_SESSION_TYPE_XVNC); scp_session_set_type(session, SCP_SESSION_TYPE_XVNC);
} }
else if (code == 1)
{
scp_session_set_type(session, SCP_SESSION_TYPE_RESIZABLE_XVNC);
}
else if (code == 10) else if (code == 10)
{ {
scp_session_set_type(session, SCP_SESSION_TYPE_XRDP); scp_session_set_type(session, SCP_SESSION_TYPE_XRDP);

View File

@ -120,7 +120,8 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
"username %s", s->username); "username %s", s->username);
} }
if (SCP_SESSION_TYPE_XVNC == s->type) if (SCP_SESSION_TYPE_XVNC == s->type ||
SCP_SESSION_TYPE_RESIZABLE_XVNC == s->type)
{ {
log_message( LOG_LEVEL_INFO, "starting Xvnc session..."); log_message( LOG_LEVEL_INFO, "starting Xvnc session...");
display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s); display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s);

View File

@ -124,7 +124,8 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s", s->username); log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s", s->username);
} }
if (SCP_SESSION_TYPE_XVNC == s->type) if (SCP_SESSION_TYPE_XVNC == s->type ||
SCP_SESSION_TYPE_RESIZABLE_XVNC == s->type)
{ {
log_message(LOG_LEVEL_INFO, "starting Xvnc session..."); log_message(LOG_LEVEL_INFO, "starting Xvnc session...");
display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s); display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s);

View File

@ -105,10 +105,13 @@ session_get_bydata(const char *name, int width, int height, int bpp, int type,
{ {
case SCP_SESSION_TYPE_XVNC: /* 0 */ case SCP_SESSION_TYPE_XVNC: /* 0 */
type = SESMAN_SESSION_TYPE_XVNC; /* 2 */ type = SESMAN_SESSION_TYPE_XVNC; /* 2 */
/* Xvnc cannot resize */ /* standard Xvnc can never resize */
policy = (enum SESMAN_CFG_SESS_POLICY) policy = (enum SESMAN_CFG_SESS_POLICY)
(policy | SESMAN_CFG_SESS_POLICY_D); (policy | SESMAN_CFG_SESS_POLICY_D);
break; break;
case SCP_SESSION_TYPE_RESIZABLE_XVNC:
type = SESMAN_SESSION_TYPE_XVNC;
break;
case SCP_SESSION_TYPE_XRDP: /* 1 */ case SCP_SESSION_TYPE_XRDP: /* 1 */
type = SESMAN_SESSION_TYPE_XRDP; /* 1 */ type = SESMAN_SESSION_TYPE_XRDP; /* 1 */
break; break;

View File

@ -31,6 +31,10 @@
#include "sesman.h" #include "sesman.h"
#include "tcp.h" #include "tcp.h"
#if !defined(PACKAGE_VERSION)
#define PACKAGE_VERSION "???"
#endif
struct config_sesman g_cfg; /* config.h */ struct config_sesman g_cfg; /* config.h */
/******************************************************************************/ /******************************************************************************/
@ -61,10 +65,14 @@ main(int argc, char **argv)
if (argc == 1) if (argc == 1)
{ {
g_printf("xrdp session starter v0.1\n"); g_printf("xrdp session starter v" PACKAGE_VERSION "\n");
g_printf("\nusage:\n"); g_printf("\nusage:\n");
g_printf("sesrun <server> <username> <password> <width> <height> <bpp> <session_cod>\n"); g_printf("sesrun <server> <username> <password> <width> <height> <bpp> <session_code>\n");
g_printf("session code 0 for Xvnc, 10 for X11RDP, 20 for Xorg\n"); g_printf("session code:-\n");
g_printf(" - 0 for fixed Xvnc\n");
g_printf(" - 1 for resizeable Xvnc\n");
g_printf(" - 10 for X11RDP\n");
g_printf(" - 20 for Xorg\n");
} }
else if (argc == 8) else if (argc == 8)
{ {

View File

@ -171,6 +171,12 @@ ip=127.0.0.1
port=-1 port=-1
#xserverbpp=24 #xserverbpp=24
#delay_ms=2000 #delay_ms=2000
; If your Xvnc server supports the ExtendedDesktopSize encoding, you can
; uncomment the following line for resizeable session support. This includes
; support for multiple monitors.
; Unlike traditional VNC sessions, you can connect to (and resize) active
; VNC sessions on the same machine which have different sizes.
#code=1
[vnc-any] [vnc-any]
name=vnc-any name=vnc-any

View File

@ -197,7 +197,7 @@ xrdp_mm_send_login(struct xrdp_mm *self)
} }
else if (g_strcasecmp(name, "code") == 0) else if (g_strcasecmp(name, "code") == 0)
{ {
/* this code is either 0 for Xvnc, 10 for X11rdp or 20 for Xorg */ /* this code is either 0/1 for Xvnc, 10 for X11rdp or 20 for Xorg */
self->code = g_atoi(value); self->code = g_atoi(value);
} }
else if (g_strcasecmp(name, "xserverbpp") == 0) else if (g_strcasecmp(name, "xserverbpp") == 0)
@ -215,7 +215,7 @@ xrdp_mm_send_login(struct xrdp_mm *self)
s = trans_get_out_s(self->sesman_trans, 8192); s = trans_get_out_s(self->sesman_trans, 8192);
s_push_layer(s, channel_hdr, 8); s_push_layer(s, channel_hdr, 8);
/* this code is either 0 for Xvnc, 10 for X11rdp or 20 for Xorg */ /* this code is either 0/1 for Xvnc, 10 for X11rdp or 20 for Xorg */
out_uint16_be(s, self->code); out_uint16_be(s, self->code);
index = g_strlen(username); index = g_strlen(username);
out_uint16_be(s, index); out_uint16_be(s, index);
@ -515,7 +515,7 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid)
{ {
if (self->display > 0) if (self->display > 0)
{ {
if (self->code == 0) /* Xvnc */ if (self->code == 0 || self->code == 1) /* Xvnc */
{ {
g_snprintf(text, 255, "%d", 5900 + self->display); g_snprintf(text, 255, "%d", 5900 + self->display);
} }
@ -1903,7 +1903,7 @@ cleanup_states(struct xrdp_mm *self)
self-> sesman_trans_up = 0; /* true once connected 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-> delete_sesman_trans = 0; /* boolean set when done with sesman connection */
self-> display = 0; /* 10 for :10.0, 11 for :11.0, etc */ 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-> code = 0; /* 0/1 Xvnc session, 10 X11rdp session, 20 Xorg session */
self-> sesman_controlled = 0; /* true if this is a sesman session */ self-> sesman_controlled = 0; /* true if this is a sesman session */
self-> chan_trans = NULL; /* connection to chansrv */ self-> chan_trans = NULL; /* connection to chansrv */
self-> chan_trans_up = 0; /* true once connected to chansrv */ self-> chan_trans_up = 0; /* true once connected to chansrv */

View File

@ -290,7 +290,7 @@ struct xrdp_mm
int (*mod_exit)(struct xrdp_mod*); int (*mod_exit)(struct xrdp_mod*);
struct xrdp_mod* mod; /* module interface */ struct xrdp_mod* mod; /* module interface */
int display; /* 10 for :10.0, 11 for :11.0, etc */ int display; /* 10 for :10.0, 11 for :11.0, etc */
int code; /* 0=Xvnc session, 10=X11rdp session, 20=xorg driver mode */ int code; /* 0/1=Xvnc session, 10=X11rdp session, 20=xorg driver mode */
int sesman_controlled; /* true if this is a sesman session */ int sesman_controlled; /* true if this is a sesman session */
struct trans* chan_trans; /* connection to chansrv */ struct trans* chan_trans; /* connection to chansrv */
int chan_trans_up; /* true once connected to chansrv */ int chan_trans_up; /* true once connected to chansrv */