From 6f74efa70a1002a458ff0c9a4dc7d6e62078f0d9 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 17 Jul 2016 23:28:37 -0700 Subject: [PATCH 1/3] add session_info Conflicts: libxrdp/libxrdp.h --- libxrdp/libxrdp.c | 13 ++++++++++++- libxrdp/libxrdp.h | 3 +++ libxrdp/libxrdpinc.h | 3 +++ libxrdp/xrdp_rdp.c | 41 +++++++++++++++++++++++++++++++++++++++++ xrdp/xrdp.h | 3 +++ xrdp/xrdp_mm.c | 12 ++++++++++++ xrdp/xrdp_types.h | 4 +++- 7 files changed, 77 insertions(+), 2 deletions(-) diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index c52829f8..6c1ee3d0 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -1487,6 +1487,17 @@ libxrdp_fastpath_send_frame_marker(struct xrdp_session *session, } free_stream(s); return 0; - +} + +/*****************************************************************************/ +int EXPORT_CC +libxrdp_send_session_info(struct xrdp_session *session, const char *data, + int data_bytes) +{ + struct xrdp_rdp *rdp; + + LLOGLN(10, ("libxrdp_send_session_info:")); + rdp = (struct xrdp_rdp *) (session->rdp); + return xrdp_rdp_send_session_info(rdp, data, data_bytes); } diff --git a/libxrdp/libxrdp.h b/libxrdp/libxrdp.h index 857abc99..9b781c5c 100644 --- a/libxrdp/libxrdp.h +++ b/libxrdp/libxrdp.h @@ -402,6 +402,9 @@ int APP_CC xrdp_rdp_disconnect(struct xrdp_rdp *self); int APP_CC xrdp_rdp_send_deactivate(struct xrdp_rdp *self); +int APP_CC +xrdp_rdp_send_session_info(struct xrdp_rdp *self, const char *data, + int data_bytes); /* xrdp_orders.c */ struct xrdp_orders * APP_CC diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index 275b674a..bd4f89dc 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -247,5 +247,8 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session, int EXPORT_CC libxrdp_fastpath_send_frame_marker(struct xrdp_session *session, int frame_action, int frame_id); +int EXPORT_CC +libxrdp_send_session_info(struct xrdp_session *session, const char *data, + int data_bytes); #endif diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 219c0260..9b1f54fd 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -1252,3 +1252,44 @@ xrdp_rdp_send_deactivate(struct xrdp_rdp *self) DEBUG(("out xrdp_rdp_send_deactivate")); return 0; } + +/*****************************************************************************/ +int APP_CC +xrdp_rdp_send_session_info(struct xrdp_rdp *self, const char *data, + int data_bytes) +{ + struct stream *s; + + LLOGLN(0, ("xrdp_rdp_send_session_info: data_bytes %d", data_bytes)); + make_stream(s); + init_stream(s, 8192); + + if (xrdp_rdp_init_data(self, s) != 0) + { + free_stream(s); + return 1; + } + + if (s_check_rem_out(s, data_bytes)) + { + out_uint8a(s, data, data_bytes); + } + else + { + free_stream(s); + return 1; + } + + s_mark_end(s); + + /* SAVE_SESSION_INFO 0x26 */ + if (xrdp_rdp_send_data(self, s, 0x26) != 0) + { + free_stream(s); + return 1; + } + + free_stream(s); + return 0; +} + diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h index edf88cc4..a84a4c07 100644 --- a/xrdp/xrdp.h +++ b/xrdp/xrdp.h @@ -514,3 +514,6 @@ int DEFAULT_CC server_add_char_alpha(struct xrdp_mod* mod, int font, int character, int offset, int baseline, int width, int height, char* data); +int DEFAULT_CC +server_session_info(struct xrdp_mod *mod, const char *data, int data_bytes); + diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index df859c0a..9cb0eeef 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -472,6 +472,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) self->mod->server_paint_rect_bpp = server_paint_rect_bpp; self->mod->server_composite = server_composite; self->mod->server_paint_rects = server_paint_rects; + self->mod->server_session_info = server_session_info; self->mod->si = (tintptr) &(self->wm->session->si); } } @@ -2599,6 +2600,17 @@ server_paint_rects(struct xrdp_mod* mod, int num_drects, short *drects, return 0; } +/*****************************************************************************/ +int DEFAULT_CC +server_session_info(struct xrdp_mod *mod, const char *data, int data_bytes) +{ + struct xrdp_wm *wm; + + LLOGLN(10, ("server_session_info:")); + wm = (struct xrdp_wm *)(mod->wm); + return libxrdp_send_session_info(wm->session, data, data_bytes); +} + /*****************************************************************************/ int DEFAULT_CC server_set_pointer(struct xrdp_mod *mod, int x, int y, diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index ca59cd1b..75c70ee7 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -146,7 +146,9 @@ struct xrdp_mod int num_crects, short *crects, char *data, int width, int height, int flags, int frame_id); - tintptr server_dumby[100 - 43]; /* align, 100 minus the number of server + int (*server_session_info)(struct xrdp_mod* v, const char *data, + int data_bytes); + tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server functions above */ /* common */ tintptr handle; /* pointer to self as int */ From 264aad7603bd1bf6d8ebe8b7c452a9a0bc8e2e4a Mon Sep 17 00:00:00 2001 From: speidy Date: Sun, 15 Jan 2017 08:24:59 +0200 Subject: [PATCH 2/3] neutrinordp: add session_info --- neutrinordp/xrdp-neutrinordp.c | 27 +++++++++++++++++++++++++++ neutrinordp/xrdp-neutrinordp.h | 27 ++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index 37b4eefb..b93b5fc0 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -1954,6 +1954,28 @@ lfreerdp_verify_certificate(freerdp *instance, char *subject, char *issuer, return 1; } +/******************************************************************************/ +static int DEFAULT_CC +lfreerdp_session_info(freerdp* instance, uint8* data, int data_bytes) +{ + struct mod *mod; + int error; + + LLOGLN(10, ("lfreerdp_session_info:")); + error = 0; + mod = ((struct mod_context *)(instance->context))->modi; + if (mod != 0) + { + LLOGLN(10, ("lfreerdp_session_info: mod->server_session_info %p", + mod->server_session_info)); + if (mod->server_session_info != 0) + { + error = mod->server_session_info(mod, (char *)data, data_bytes); + } + } + return error; +} + /******************************************************************************/ tintptr EXPORT_CC mod_init(void) @@ -1988,6 +2010,11 @@ mod_init(void) mod->inst->ReceiveChannelData = lfreerdp_receive_channel_data; mod->inst->Authenticate = lfreerdp_authenticate; mod->inst->VerifyCertificate = lfreerdp_verify_certificate; +#if defined(VERSION_STRUCT_RDP_FREERDP) +#if VERSION_STRUCT_RDP_FREERDP > 0 + mod->inst->SessionInfo = lfreerdp_session_info; +#endif +#endif freerdp_context_new(mod->inst); diff --git a/neutrinordp/xrdp-neutrinordp.h b/neutrinordp/xrdp-neutrinordp.h index fd4560d0..f5986b8a 100644 --- a/neutrinordp/xrdp-neutrinordp.h +++ b/neutrinordp/xrdp-neutrinordp.h @@ -151,9 +151,30 @@ struct mod int flags); int (*server_set_pointer_ex)(struct mod *mod, int x, int y, char *data, char *mask, int bpp); - - tintptr server_dumby[100 - 37]; /* align, 100 minus the number of server - functions above */ + int (*server_add_char_alpha)(struct mod* mod, int font, int character, + int offset, int baseline, + int width, int height, char* data); + int (*server_create_os_surface_bpp)(struct mod* v, int rdpindex, + int width, int height, int bpp); + int (*server_paint_rect_bpp)(struct mod* v, int x, int y, int cx, int cy, + char* data, int width, int height, + int srcx, int srcy, int bpp); + int (*server_composite)(struct mod* v, int srcidx, int srcformat, + int srcwidth, int srcrepeat, int* srctransform, + int mskflags, int mskidx, int mskformat, + int mskwidth, int mskrepeat, int op, + int srcx, int srcy, int mskx, int msky, + int dstx, int dsty, int width, int height, + int dstformat); + int (*server_paint_rects)(struct mod* v, + int num_drects, short *drects, + int num_crects, short *crects, + char *data, int width, int height, + int flags, int frame_id); + int (*server_session_info)(struct mod* v, const char *data, + int data_bytes); + tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server + functions above */ /* common */ tintptr handle; /* pointer to self as long */ tintptr wm; From b7da395b5e46eab4b333d53e66e7f5da61a3dc11 Mon Sep 17 00:00:00 2001 From: speidy Date: Sun, 15 Jan 2017 08:51:43 +0200 Subject: [PATCH 3/3] libxrdp: use constant RDP_DATA_PDU_LOGON --- libxrdp/xrdp_rdp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 9b1f54fd..49d8c4b2 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -1282,8 +1282,7 @@ xrdp_rdp_send_session_info(struct xrdp_rdp *self, const char *data, s_mark_end(s); - /* SAVE_SESSION_INFO 0x26 */ - if (xrdp_rdp_send_data(self, s, 0x26) != 0) + if (xrdp_rdp_send_data(self, s, RDP_DATA_PDU_LOGON) != 0) { free_stream(s); return 1;