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

This commit is contained in:
Brian Ledbetter 2024-11-11 09:26:41 -05:00
parent 65993312b7
commit a647a1748b
3 changed files with 15 additions and 1 deletions

View File

@ -22,6 +22,8 @@
#include <config_ac.h>
#endif
#include <stdio.h>
#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);

View File

@ -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;

View File

@ -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