diff options
Diffstat (limited to 'xrdp')
| -rw-r--r-- | xrdp/Makefile.am | 4 | ||||
| -rw-r--r-- | xrdp/xrdp_mm.c | 37 | ||||
| -rw-r--r-- | xrdp/xrdp_types.h | 1 |
3 files changed, 32 insertions, 10 deletions
diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am index fe14d88d..5179ef68 100644 --- a/xrdp/Makefile.am +++ b/xrdp/Makefile.am @@ -12,7 +12,8 @@ AM_CPPFLAGS = \ -DXRDP_SOCKET_PATH=\"${socketdir}\" \ -I$(top_builddir) \ -I$(top_srcdir)/common \ - -I$(top_srcdir)/libxrdp + -I$(top_srcdir)/libxrdp \ + -I$(top_srcdir)/raptorsmiface XRDP_EXTRA_LIBS = @@ -63,6 +64,7 @@ xrdp_SOURCES = \ xrdp_LDADD = \ $(top_builddir)/common/libcommon.la \ $(top_builddir)/libxrdp/libxrdp.la \ + $(top_builddir)/raptorsmiface/libraptorsmiface.la \ $(XRDP_EXTRA_LIBS) xrdpsysconfdir=$(sysconfdir)/xrdp diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 7d204b5b..1bb7ea15 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -24,6 +24,8 @@ #include "xrdp.h" #include "log.h" +#include "libraptorsmiface.h" + #ifndef USE_NOPAM #if defined(HAVE__PAM_TYPES_H) #define LINUXPAM 1 @@ -59,6 +61,7 @@ xrdp_mm_create(struct xrdp_wm *owner) self->wm = owner; self->login_names = list_create(); self->login_names->auto_free = 1; + self->login_username = 0; self->login_values = list_create(); self->login_values->auto_free = 1; @@ -190,6 +193,7 @@ xrdp_mm_send_login(struct xrdp_mm *self) if (g_strcasecmp(name, "username") == 0) { username = value; + self->login_username = g_strdup(username); } else if (g_strcasecmp(name, "password") == 0) { @@ -521,16 +525,30 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid) } else if (self->code == 10 || self->code == 20) /* X11rdp/Xorg */ { - use_uds = 1; - - if (xrdp_mm_get_value(self, "ip", text, 255) == 0) - { - if (g_strcmp(text, "127.0.0.1") != 0) - { + char* rsmip = raptor_sm_get_ip_for_username(self->login_username, true); + int allocdisplay = raptor_sm_get_display_for_username(self->login_username); + if ((raptor_sm_sesslimit_reached(self->login_username)) && (allocdisplay < 0)) { + g_snprintf(text, 255, "[LICENSE] Maximum concurrent session"); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR, text); + g_snprintf(text, 255, "[LICENSE] limit exceeded for group."); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR, text); + g_snprintf(text, 255, "[LICENSE] Login for user %s denied.", self->login_username); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR, text); + raptor_sm_session_terminated(self->login_username); + return 1; + } + else { + if (allocdisplay >= 0) { + self->display = allocdisplay; + } + self->mod->mod_set_param(self->mod, "ip", rsmip); + use_uds = 1; + if (g_strcmp(rsmip, "127.0.0.1") != 0) { use_uds = 0; } } + g_free(rsmip); if (use_uds) { g_snprintf(text, 255, XRDP_X11RDP_STR, self->display); @@ -576,7 +594,9 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid) { name = (const char *) list_get_item(self->login_names, i); value = (const char *) list_get_item(self->login_values, i); - self->mod->mod_set_param(self->mod, name, value); + if (strcmp(name, "ip") != 0) { + self->mod->mod_set_param(self->mod, name, value); + } } /* connect */ @@ -1546,8 +1566,7 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s) if (ok) { self->display = display; - xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO, - "login successful for display %d", display); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO, "login successful on display %d", display); if (xrdp_mm_setup_mod1(self) == 0) { diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 7e416125..2cb51b80 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -294,6 +294,7 @@ struct xrdp_mm int chan_trans_up; /* true once connected to chansrv */ int delete_chan_trans; /* boolean set when done with channel connection */ int usechansrv; /* true if chansrvport is set in xrdp.ini or using sesman */ + char* login_username; /* RAPTOR */ struct xrdp_encoder *encoder; int cs2xr_cid_map[256]; int xr2cr_cid_map[256]; |
