xrdp/vnc
matt335672 275eaf7683 Rework transport connect logic
There are a number of ways the existing transport connect logic in
trans_connect could be improved for POSIX compatibility, and also
slightly tidied up:-
1) The same socket is re-used for multiple connect attempts following
   failure which isn't behaviour defined by POSIX.1-2017 (although it
   works on Linux).
2) An asynchronous connect is started, and then after a short
   delay connect() is called again on the same socket. POSIX.1-2017
   is clear that in this situation EALREADY is returned before the
   connection is established, but is silent on the behaviour expected
   when the connection is established. Returning success is an option,
   but so is returning EISCONN. The current code assumes the connect()
   call will succeed.
3) The code contains two virtually identical, quite complex loops for
   TCP and UNIX sockets, differing only in the calls to create a socket
   and connect it.
4) trans_connect() contains looping and retry logic, but this isn't
   seen as sufficient by the chansrv connect code in xrdp/xrdp_mm.c and
   the Xorg connect code in xup/xup.c. Both of these implement their own
   looping and retry logic on top of the logic in trans_connect(),
   resulting in slightly unpredictable behaviour with regard to
   timeouts.
5) A socket number can technically be zero, but in a couple of places
   this isn't allowed for.

This PR attempts to correct the implementation of trans_connect(),
and also to simplify the areas it is called from.

As part of the PR, the signature of the server_is_term member of the
xrdp module interface is changed to match the signature expected by the
is_term member of a struct trans. This allows for trans_connect()
in xrdp modules to directly access g_is_term() within the main xrdp
executable. At the moment this functionality is only used by the xup
module.
2022-03-31 20:48:07 +01:00
..
Makefile.am Add missing rfb.c to the VNC module makefile 2021-09-08 09:46:29 +01:00
rfb.c Rename misnamed function get_eds_status_msg 2021-09-06 10:33:09 +01:00
rfb.h Split up vnc.c into modules and re-implement clipboard functions 2021-06-08 14:11:17 +01:00
vnc.c Updating to refactor xrdp_client_info 2022-03-27 16:38:32 -04:00
vnc.h Rework transport connect logic 2022-03-31 20:48:07 +01:00
vnc_clip.c Remove s_check() macro 2022-02-09 10:18:15 +00:00
vnc_clip.h Split up vnc.c into modules and re-implement clipboard functions 2021-06-08 14:11:17 +01:00