diff --git a/mc/mc.c b/mc/mc.c index 1b018ef1..a1bbbb16 100644 --- a/mc/mc.c +++ b/mc/mc.c @@ -41,7 +41,7 @@ lib_mod_start(struct mod *mod, int w, int h, int bpp) /******************************************************************************/ /* return error */ static int -lib_mod_connect(struct mod *mod) +lib_mod_connect(struct mod *mod, int fd) { LOG_DEVEL(LOG_LEVEL_TRACE, "in lib_mod_connect"); LOG_DEVEL(LOG_LEVEL_TRACE, "out lib_mod_connect"); diff --git a/mc/mc.h b/mc/mc.h index f15e3f9a..5223e0f9 100644 --- a/mc/mc.h +++ b/mc/mc.h @@ -41,7 +41,7 @@ struct mod int version; /* internal version */ /* client functions */ int (*mod_start)(struct mod *v, int w, int h, int bpp); - int (*mod_connect)(struct mod *v); + int (*mod_connect)(struct mod *v, int fd); int (*mod_event)(struct mod *v, int msg, long param1, long param2, long param3, long param4); int (*mod_signal)(struct mod *v); diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index a217a0c0..16aa27d8 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -182,15 +182,25 @@ set_keyboard_overrides(struct mod *mod) } static int -lxrdp_connect(struct mod *mod) +lxrdp_connect(struct mod *mod, int fd) { boolean ok; set_keyboard_overrides(mod); LOG_DEVEL(LOG_LEVEL_TRACE, "lxrdp_connect:"); - ok = freerdp_connect(mod->inst); - LOG_DEVEL(LOG_LEVEL_INFO, "lxrdp_connect: freerdp_connect returned %d", ok); + if (fd >= 0) + { + LOG(LOG_LEVEL_ERROR, + "NeutrinoRDP : Can't connect to a file descriptor"); + ok = 0; + } + else + { + ok = freerdp_connect(mod->inst); + LOG_DEVEL(LOG_LEVEL_INFO, + "lxrdp_connect: freerdp_connect returned %d", ok); + } if (!ok) { diff --git a/neutrinordp/xrdp-neutrinordp.h b/neutrinordp/xrdp-neutrinordp.h index fc8aa7ae..39449180 100644 --- a/neutrinordp/xrdp-neutrinordp.h +++ b/neutrinordp/xrdp-neutrinordp.h @@ -74,7 +74,7 @@ struct mod int version; /* internal version */ /* client functions */ int (*mod_start)(struct mod *v, int w, int h, int bpp); - int (*mod_connect)(struct mod *v); + int (*mod_connect)(struct mod *v, int fd); int (*mod_event)(struct mod *v, int msg, long param1, long param2, long param3, long param4); int (*mod_signal)(struct mod *v); diff --git a/vnc/vnc.c b/vnc/vnc.c index 607fe043..988cc525 100644 --- a/vnc/vnc.c +++ b/vnc/vnc.c @@ -2237,7 +2237,7 @@ set_encodings(struct vnc *v) return error */ static int -lib_mod_connect(struct vnc *v) +lib_mod_connect(struct vnc *v, int fd) { char cursor_data[32 * (32 * 3)]; char cursor_mask[32 * (32 / 8)]; @@ -2298,7 +2298,17 @@ lib_mod_connect(struct vnc *v) v->trans->si = v->si; v->trans->my_source = XRDP_SOURCE_MOD; - error = trans_connect(v->trans, v->ip, con_port, 3000); + if (fd >= 0) + { + v->trans->sck = fd; + v->trans->status = TRANS_STATUS_UP; /* ok */ + v->trans->type1 = TRANS_TYPE_CLIENT; /* client */ + error = 0; + } + else + { + error = trans_connect(v->trans, v->ip, con_port, 3000); + } if (error != 0) { diff --git a/vnc/vnc.h b/vnc/vnc.h index a69c2690..be251f75 100644 --- a/vnc/vnc.h +++ b/vnc/vnc.h @@ -83,7 +83,7 @@ struct vnc int version; /* internal version */ /* client functions */ int (*mod_start)(struct vnc *v, int w, int h, int bpp); - int (*mod_connect)(struct vnc *v); + int (*mod_connect)(struct vnc *v, int fd); int (*mod_event)(struct vnc *v, int msg, long param1, long param2, long param3, long param4); int (*mod_signal)(struct vnc *v); diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index e6111ba6..55f6da08 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -55,7 +55,7 @@ struct xrdp_mod int version; /* internal version */ /* client functions */ int (*mod_start)(struct xrdp_mod *v, int w, int h, int bpp); - int (*mod_connect)(struct xrdp_mod *v); + int (*mod_connect)(struct xrdp_mod *v, int fd); int (*mod_event)(struct xrdp_mod *v, int msg, long param1, long param2, long param3, long param4); int (*mod_signal)(struct xrdp_mod *v); diff --git a/xup/xup.c b/xup/xup.c index de37fa7f..b72f1391 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -261,7 +261,7 @@ lib_send_client_info(struct mod *mod) /******************************************************************************/ /* return error */ static int -lib_mod_connect(struct mod *mod) +lib_mod_connect(struct mod *mod, int fd) { int error; int socket_mode; @@ -356,8 +356,19 @@ lib_mod_connect(struct mod *mod) mod->trans->no_stream_init_on_data_in = 1; mod->trans->extra_flags = 1; - /* Give the X server a bit of time to start */ - error = trans_connect(mod->trans, mod->ip, con_port, 30 * 1000); + if (fd >= 0) + { + mod->trans->sck = fd; + mod->trans->status = TRANS_STATUS_UP; /* ok */ + mod->trans->type1 = TRANS_TYPE_CLIENT; /* client */ + error = 0; + } + else + { + /* Give the X server a bit of time to start */ + error = trans_connect(mod->trans, mod->ip, con_port, 30 * 1000); + } + if (error == 0) { LOG_DEVEL(LOG_LEVEL_INFO, "lib_mod_connect: connected to Xserver " diff --git a/xup/xup.h b/xup/xup.h index 0045d72a..fea04b3b 100644 --- a/xup/xup.h +++ b/xup/xup.h @@ -53,7 +53,7 @@ struct mod int version; /* internal version */ /* client functions */ int (*mod_start)(struct mod *v, int w, int h, int bpp); - int (*mod_connect)(struct mod *v); + int (*mod_connect)(struct mod *v, int fd); int (*mod_event)(struct mod *v, int msg, tbus param1, tbus param2, tbus param3, tbus param4); int (*mod_signal)(struct mod *v);