diff options
author | Timothy Pearson <tpearson@raptorengineering.com> | 2019-03-02 19:39:52 -0600 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-03-02 19:49:22 -0600 |
commit | 315b8914c853078d8bb04a7d16e47d19128ca318 (patch) | |
tree | 5e64fe8ea46443663d287360c5b6b45aea095fb1 /xrdp/xrdp_mm.c | |
parent | 58e06a0aa7db8e0762b31304ead0c3e0df5a7be4 (diff) | |
download | xrdp-proprietary-315b8914c853078d8bb04a7d16e47d19128ca318.tar.gz xrdp-proprietary-315b8914c853078d8bb04a7d16e47d19128ca318.zip |
Second batch of initial commits:
* Add server/group pamming
* Partially fix immediate exit after login
Still will not compile due to libraptorsmiface being too new
Diffstat (limited to 'xrdp/xrdp_mm.c')
-rw-r--r-- | xrdp/xrdp_mm.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 1bb7ea15..d62947fa 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -21,6 +21,7 @@ #if defined(HAVE_CONFIG_H) #include <config_ac.h> #endif +#include <string.h> #include "xrdp.h" #include "log.h" @@ -494,6 +495,7 @@ static int xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid) { char text[256]; + char raptortext[256]; const char *name; const char *value; int i; @@ -526,14 +528,24 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid) else if (self->code == 10 || self->code == 20) /* X11rdp/Xorg */ { char* rsmip = raptor_sm_get_ip_for_username(self->login_username, true); + if (strcmp(rsmip, "ERROR") == 0) { + g_snprintf(raptortext, 255, "[LICENSE] Instantaneous limit exceeded."); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING, raptortext); + g_snprintf(raptortext, 255, "[LICENSE] Login for user %s denied.", self->login_username); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING, raptortext); + g_free(rsmip); + raptor_sm_session_terminated(self->login_username); + return 1; + } 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); + g_snprintf(raptortext, 255, "[LICENSE] Maximum concurrent session"); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING, raptortext); + g_snprintf(raptortext, 255, "[LICENSE] limit exceeded for group."); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING, raptortext); + g_snprintf(raptortext, 255, "[LICENSE] Login for user %s denied.", self->login_username); + xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING, raptortext); + g_free(rsmip); raptor_sm_session_terminated(self->login_username); return 1; } @@ -542,10 +554,14 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self, tui8 *guid) self->display = allocdisplay; } self->mod->mod_set_param(self->mod, "ip", rsmip); +#ifdef DISABLE_UNIX_DOMAIN_SOCKETS + use_uds = 0; +#else use_uds = 1; if (g_strcmp(rsmip, "127.0.0.1") != 0) { use_uds = 0; } +#endif } g_free(rsmip); @@ -1432,7 +1448,11 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port) self->usechansrv = 1; /* connect channel redir */ +#ifdef DISABLE_UNIX_DOMAIN_SOCKETS + if (0) +#else if ((g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0)) +#endif { /* unix socket */ self->chan_trans = trans_create(TRANS_MODE_UNIX, 8192, 8192); @@ -1577,7 +1597,11 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s) self->wm->dragging = 0; /* connect channel redir */ +#ifdef DISABLE_UNIX_DOMAIN_SOCKETS + if (0) +#else if ((g_strcmp(ip, "127.0.0.1") == 0) || (ip[0] == 0)) +#endif { g_snprintf(port, 255, XRDP_CHANSRV_STR, display); } |