From a647a1748b3867d09826f8ada201d59b87ca3831 Mon Sep 17 00:00:00 2001 From: Brian Ledbetter Date: Mon, 11 Nov 2024 09:26:41 -0500 Subject: [PATCH] Adds an enable_auto_login flag to xrdp.ini that will automatically start the (only/first) defined session when it is enabled; does nothing if flag is not set --- xrdp/xrdp_login_wnd.c | 13 +++++++++++++ xrdp/xrdp_types.h | 1 + xrdp/xrdp_wm.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index 650be6bc..09682258 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -22,6 +22,8 @@ #include #endif +#include + #include "base64.h" #include "xrdp.h" #include "log.h" @@ -1063,11 +1065,14 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) int fd; int i; + LOG(LOG_LEVEL_INFO, "got to config function"); + if (!config) { return -1; } + LOG(LOG_LEVEL_INFO, "and continuing"); globals = &config->cfg_globals; /* set default values in case we can't get them from xrdp.ini file */ @@ -1135,6 +1140,8 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) n = (char *) list_get_item(names, i); v = (char *) list_get_item(values, i); + LOG(LOG_LEVEL_INFO, "config: %s -> %s", n, v); + /* * parse globals section */ @@ -1264,6 +1271,12 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) g_strncpy(globals->autorun, v, 255); } + else if (g_strncmp(n, "enable_auto_login", 64) == 0) + { + LOG(LOG_LEVEL_INFO, "enable auto login: %s", v); + globals->enable_auto_login = g_text2bool(v); + } + else if (g_strncmp(n, "hidelogwindow", 64) == 0) { globals->hidelogwindow = g_text2bool(v); diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index c5c80975..e1a391b1 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -808,6 +808,7 @@ struct xrdp_cfg_globals int tcp_send_buffer_bytes; int tcp_recv_buffer_bytes; char autorun[256]; + int enable_auto_login; int hidelogwindow; int require_credentials; int bulk_compression; diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index 1efffc15..637e6f51 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -666,7 +666,7 @@ xrdp_wm_init(struct xrdp_wm *self) xrdp_wm_load_static_pointers(self); self->screen->bg_color = self->xrdp_config->cfg_globals.ls_top_window_bg_color; - if (self->session->client_info->rdp_autologin) + if (self->xrdp_config->cfg_globals.enable_auto_login || self->session->client_info->rdp_autologin) { /* * NOTE: this should eventually be accessed from self->xrdp_config