xrdp: xrdp_wm: changed the autologin logic
This commit is contained in:
parent
9e4f4159ef
commit
fc753a9504
@ -545,13 +545,15 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
char cfg_file[256];
|
char cfg_file[256];
|
||||||
char autorun_name[256];
|
char autorun_name[256];
|
||||||
|
|
||||||
|
g_writeln("in xrdp_wm_init: ");
|
||||||
|
|
||||||
load_xrdp_config(self->xrdp_config, self->screen->bpp);
|
load_xrdp_config(self->xrdp_config, self->screen->bpp);
|
||||||
|
|
||||||
xrdp_wm_load_static_colors_plus(self, autorun_name);
|
xrdp_wm_load_static_colors_plus(self, autorun_name);
|
||||||
xrdp_wm_load_static_pointers(self);
|
xrdp_wm_load_static_pointers(self);
|
||||||
self->screen->bg_color = self->xrdp_config->cfg_globals.ls_top_window_bg_color;
|
self->screen->bg_color = self->xrdp_config->cfg_globals.ls_top_window_bg_color;
|
||||||
|
|
||||||
if (self->session->client_info->rdp_autologin || (autorun_name[0] != 0))
|
if (self->session->client_info->rdp_autologin)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NOTE: this should eventually be accessed from self->xrdp_config
|
* NOTE: this should eventually be accessed from self->xrdp_config
|
||||||
@ -559,23 +561,29 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
|
|
||||||
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
|
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
|
||||||
fd = g_file_open(cfg_file); /* xrdp.ini */
|
fd = g_file_open(cfg_file); /* xrdp.ini */
|
||||||
|
|
||||||
if (fd > 0)
|
if (fd > 0)
|
||||||
{
|
{
|
||||||
names = list_create();
|
names = list_create();
|
||||||
names->auto_free = 1;
|
names->auto_free = 1;
|
||||||
values = list_create();
|
values = list_create();
|
||||||
values->auto_free = 1;
|
values->auto_free = 1;
|
||||||
/* domain names that starts with '_' are reserved for IP/DNS to
|
|
||||||
* simplify for the user in a gateway setup */
|
/* look for module name to be loaded */
|
||||||
if (self->session->client_info->domain[0] != '_')
|
if (autorun_name[0] != 0) {
|
||||||
|
/* if autorun is configured in xrdp.ini, we enforce that module to be loaded */
|
||||||
|
g_strncpy(section_name, autorun_name, 255);
|
||||||
|
}
|
||||||
|
else if (self->session->client_info->domain &&
|
||||||
|
self->session->client_info->domain[0] != '_')
|
||||||
{
|
{
|
||||||
|
/* domain names that starts with '_' are reserved for IP/DNS to
|
||||||
|
* simplify for the user in a proxy setup */
|
||||||
|
|
||||||
|
/* we use the domain name as the module name to be loaded */
|
||||||
g_strncpy(section_name, self->session->client_info->domain,
|
g_strncpy(section_name, self->session->client_info->domain,
|
||||||
255);
|
255);
|
||||||
}
|
}
|
||||||
if (section_name[0] == 0)
|
else
|
||||||
{
|
|
||||||
if (autorun_name[0] == 0)
|
|
||||||
{
|
{
|
||||||
/* if no domain is passed, and no autorun in xrdp.ini,
|
/* if no domain is passed, and no autorun in xrdp.ini,
|
||||||
use the first item in the xrdp.ini
|
use the first item in the xrdp.ini
|
||||||
@ -596,14 +604,10 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_strncpy(section_name, autorun_name, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list_clear(names);
|
list_clear(names);
|
||||||
|
|
||||||
|
/* look for the required module in xrdp.ini, fetch its parameters */
|
||||||
if (file_read_section(fd, section_name, names, values) == 0)
|
if (file_read_section(fd, section_name, names, values) == 0)
|
||||||
{
|
{
|
||||||
for (index = 0; index < names->count; index++)
|
for (index = 0; index < names->count; index++)
|
||||||
@ -663,6 +667,13 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
|
|
||||||
xrdp_wm_set_login_mode(self, 2);
|
xrdp_wm_set_login_mode(self, 2);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* requested module name not found in xrdp.ini */
|
||||||
|
g_writeln(" xrdp_wm_init: file_read_section returned non-zero, requested section not found in xrdp.ini");
|
||||||
|
xrdp_wm_log_msg(self, "ERROR: The requested xrdp module not found in xrdp.ini,"
|
||||||
|
" falling back to login window");
|
||||||
|
}
|
||||||
|
|
||||||
list_delete(names);
|
list_delete(names);
|
||||||
list_delete(values);
|
list_delete(values);
|
||||||
@ -675,6 +686,7 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_writeln(" xrdp_wm_init: no autologin / auto run detected, draw login window");
|
||||||
xrdp_login_wnd_create(self);
|
xrdp_login_wnd_create(self);
|
||||||
/* clear screen */
|
/* clear screen */
|
||||||
xrdp_bitmap_invalidate(self->screen, 0);
|
xrdp_bitmap_invalidate(self->screen, 0);
|
||||||
@ -682,6 +694,7 @@ xrdp_wm_init(struct xrdp_wm *self)
|
|||||||
xrdp_wm_set_login_mode(self, 1);
|
xrdp_wm_set_login_mode(self, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_writeln("out xrdp_wm_init: ");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1725,6 +1738,8 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
|
|||||||
static int APP_CC
|
static int APP_CC
|
||||||
xrdp_wm_login_mode_changed(struct xrdp_wm *self)
|
xrdp_wm_login_mode_changed(struct xrdp_wm *self)
|
||||||
{
|
{
|
||||||
|
g_writeln("xrdp_wm_login_mode_changed: login_mode is %d", self->login_mode);
|
||||||
|
|
||||||
if (self == 0)
|
if (self == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user