mirror of https://github.com/neutrinolabs/xrdp
Refactor xrdp_mm.c
- Add connect state machine - Use SCP for sesman comms
This commit is contained in:
parent
582433b827
commit
9abe0960f7
|
@ -422,7 +422,7 @@ struct xrdp_mm *
|
|||
xrdp_mm_create(struct xrdp_wm *owner);
|
||||
void
|
||||
xrdp_mm_delete(struct xrdp_mm *self);
|
||||
int
|
||||
void
|
||||
xrdp_mm_connect(struct xrdp_mm *self);
|
||||
int
|
||||
xrdp_mm_process_channel_data(struct xrdp_mm *self, tbus param1, tbus param2,
|
||||
|
|
1337
xrdp/xrdp_mm.c
1337
xrdp/xrdp_mm.c
File diff suppressed because it is too large
Load Diff
|
@ -27,6 +27,7 @@
|
|||
#include "xrdp_rail.h"
|
||||
#include "xrdp_constants.h"
|
||||
#include "fifo.h"
|
||||
#include "guid.h"
|
||||
|
||||
#define MAX_NR_CHANNELS 16
|
||||
#define MAX_CHANNEL_NAME 16
|
||||
|
@ -295,13 +296,40 @@ struct xrdp_cache
|
|||
/* defined later */
|
||||
struct xrdp_enc_data;
|
||||
|
||||
/**
|
||||
* Stages we go through connecting to the session
|
||||
*/
|
||||
enum mm_connect_state
|
||||
{
|
||||
MMCS_CONNECT_TO_SESMAN,
|
||||
MMCS_PAM_AUTH,
|
||||
MMCS_SESSION_AUTH,
|
||||
MMCS_CONNECT_TO_SESSION,
|
||||
MMCS_CONNECT_TO_CHANSRV,
|
||||
MMCS_DONE
|
||||
};
|
||||
|
||||
struct xrdp_mm
|
||||
{
|
||||
struct xrdp_wm *wm; /* owner */
|
||||
int connected_state; /* true if connected to sesman else false */
|
||||
enum mm_connect_state connect_state; /* State of connection */
|
||||
/* Other processes we connect to */
|
||||
/* NB : When we move to UDS, the sesman and pam_auth
|
||||
* connection be merged */
|
||||
int use_sesman; /* true if this is a sesman session */
|
||||
int use_pam_auth; /* True if we're to authenticate using PAM */
|
||||
int use_chansrv; /* true if chansrvport is set in xrdp.ini or using sesman */
|
||||
struct trans *sesman_trans; /* connection to sesman */
|
||||
int sesman_trans_up; /* true once connected to sesman */
|
||||
int delete_sesman_trans; /* boolean set when done with sesman connection */
|
||||
struct trans *pam_auth_trans; /* connection to pam authenticator */
|
||||
struct trans *chan_trans; /* connection to chansrv */
|
||||
|
||||
/* We can't delete transports while we're in a callback for that
|
||||
* transport, as this causes trans.c to reference undefined memory.
|
||||
* These flags mark transports as needing to be deleted when
|
||||
* we are definitely not in a transport callback */
|
||||
int delete_sesman_trans;
|
||||
int delete_pam_auth_trans;
|
||||
|
||||
struct list *login_names;
|
||||
struct list *login_values;
|
||||
/* mod vars */
|
||||
|
@ -310,12 +338,8 @@ struct xrdp_mm
|
|||
int (*mod_exit)(struct xrdp_mod *);
|
||||
struct xrdp_mod *mod; /* module interface */
|
||||
int display; /* 10 for :10.0, 11 for :11.0, etc */
|
||||
struct guid guid; /* GUID for the session, or all zeros */
|
||||
int code; /* 0=Xvnc session, 10=X11rdp session, 20=xorg driver mode */
|
||||
int sesman_controlled; /* true if this is a sesman session */
|
||||
struct trans *chan_trans; /* connection to chansrv */
|
||||
int chan_trans_up; /* true once connected to chansrv */
|
||||
int delete_chan_trans; /* boolean set when done with channel connection */
|
||||
int use_chansrv; /* true if chansrvport is set in xrdp.ini or using sesman */
|
||||
struct xrdp_encoder *encoder;
|
||||
int cs2xr_cid_map[256];
|
||||
int xr2cr_cid_map[256];
|
||||
|
|
|
@ -1956,16 +1956,13 @@ xrdp_wm_login_state_changed(struct xrdp_wm *self)
|
|||
}
|
||||
else if (self->login_state == WMLS_START_CONNECT)
|
||||
{
|
||||
if (xrdp_mm_connect(self->mm) == 0)
|
||||
{
|
||||
xrdp_wm_set_login_state(self, WMLS_CONNECT_IN_PROGRESS);
|
||||
xrdp_wm_delete_all_children(self);
|
||||
self->dragging = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we do nothing on connect error so far */
|
||||
}
|
||||
xrdp_wm_delete_all_children(self);
|
||||
self->dragging = 0;
|
||||
xrdp_wm_set_login_state(self, WMLS_CONNECT_IN_PROGRESS);
|
||||
|
||||
/* This calls back to xrdp_wm_mod_connect_done() when the
|
||||
* connect is finished*/
|
||||
xrdp_mm_connect(self->mm);
|
||||
}
|
||||
else if (self->login_state == WMLS_CLEANUP)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue