Working on aup screen
This commit is contained in:
parent
f3dc94448c
commit
11b17e161b
@ -954,7 +954,8 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
|
||||
/*
|
||||
* Ignore autologin requests if the password is empty. System managers
|
||||
* who really want to allow empty passwords can do this with a
|
||||
* special session type */
|
||||
* special session type
|
||||
*/
|
||||
if (len_password == 0 && self->rdp_layer->client_info.rdp_autologin)
|
||||
{
|
||||
LOG(LOG_LEVEL_DEBUG,
|
||||
|
||||
@ -176,6 +176,9 @@ int
|
||||
xrdp_wm_can_resize(struct xrdp_wm *self);
|
||||
void
|
||||
xrdp_wm_mod_connect_done(struct xrdp_wm *self, int status);
|
||||
void
|
||||
xrdp_wm_paint_text_list(struct xrdp_painter *painter, struct list *text_list,
|
||||
struct xrdp_bitmap *wnd, int text_color, int x, int y);
|
||||
|
||||
/* xrdp_process.c */
|
||||
struct xrdp_process *
|
||||
|
||||
@ -87,6 +87,8 @@ new_cursors=true
|
||||
use_fastpath=both
|
||||
; when true, userid/password *must* be passed on cmd line
|
||||
#require_credentials=true
|
||||
; when true, the login window will always be displayed
|
||||
always_show_login_window=true
|
||||
; when true, the userid will be used to try to authenticate
|
||||
#enable_token_login=true
|
||||
; You can set the PAM error text in a gateway setup (MAX 256 chars)
|
||||
@ -137,8 +139,8 @@ ls_top_window_bg_color=003057
|
||||
; larger, and also increase <ls_btn_ok_y_pos> and <ls_btn_cancel_y_pos>
|
||||
; below
|
||||
;
|
||||
ls_width=350
|
||||
ls_height=360
|
||||
ls_width=690
|
||||
ls_height=650
|
||||
|
||||
; login screen background color in RGB format
|
||||
ls_bg_color=f0f0f0
|
||||
@ -164,29 +166,36 @@ ls_logo_filename=
|
||||
ls_logo_transform=scale
|
||||
ls_logo_width=250
|
||||
ls_logo_height=110
|
||||
ls_logo_x_pos=55
|
||||
ls_logo_x_pos=220
|
||||
ls_logo_y_pos=35
|
||||
|
||||
; for positioning labels such as username, password etc
|
||||
ls_label_x_pos=30
|
||||
ls_label_x_pos=195
|
||||
ls_label_width=68
|
||||
|
||||
; for positioning the text of the acceptable use policy
|
||||
ls_acceptable_use_policy_filename=/home/christopher/policy_text.txt
|
||||
ls_acceptable_use_x_pos=30
|
||||
ls_acceptable_use_y_pos=240
|
||||
ls_acceptable_use_row_height=20
|
||||
ls_acceptable_use_width=800
|
||||
|
||||
; for positioning text and combo boxes next to above labels
|
||||
ls_input_x_pos=110
|
||||
ls_input_x_pos=275
|
||||
ls_input_width=210
|
||||
|
||||
; y pos for first label and combo box
|
||||
ls_input_y_pos=158
|
||||
|
||||
; OK button
|
||||
ls_btn_ok_x_pos=142
|
||||
ls_btn_ok_y_pos=308
|
||||
ls_btn_ok_x_pos=490
|
||||
ls_btn_ok_y_pos=600
|
||||
ls_btn_ok_width=85
|
||||
ls_btn_ok_height=30
|
||||
|
||||
; Cancel button
|
||||
ls_btn_cancel_x_pos=237
|
||||
ls_btn_cancel_y_pos=308
|
||||
ls_btn_cancel_x_pos=585
|
||||
ls_btn_cancel_y_pos=600
|
||||
ls_btn_cancel_width=85
|
||||
ls_btn_cancel_height=30
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "xrdp.h"
|
||||
#include "log.h"
|
||||
#include "string_calls.h"
|
||||
#include <string.h>
|
||||
|
||||
#define ASK "ask"
|
||||
#define ASK_LEN g_strlen(ASK)
|
||||
@ -124,7 +125,7 @@ xrdp_wm_delete_all_children(struct xrdp_wm *self)
|
||||
struct xrdp_bitmap *b;
|
||||
struct xrdp_rect rect;
|
||||
|
||||
for (index = self->screen->child_list->count - 1; index >= 0; index--)
|
||||
for (index = self->screen->child_list->count - 1; index >= 0; --index)
|
||||
{
|
||||
b = (struct xrdp_bitmap *)list_get_item(self->screen->child_list, index);
|
||||
MAKERECT(rect, b->left, b->top, b->width, b->height);
|
||||
@ -506,6 +507,8 @@ xrdp_wm_show_edits(struct xrdp_wm *self, struct xrdp_bitmap *combo)
|
||||
if ((g_strncasecmp(name, "password", 255) == 0) ||
|
||||
(g_strncasecmp(name, "pampassword", 255) == 0))
|
||||
{
|
||||
g_strncpy(b->caption1, self->session->client_info->password, 255);
|
||||
b->edit_pos = g_mbstowcs(0, b->caption1, 0);
|
||||
b->password_char = '*';
|
||||
|
||||
if (username_set)
|
||||
@ -742,6 +745,17 @@ xrdp_login_wnd_get_monitor_dpi(struct xrdp_wm *self)
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
split_string_by_newline(const char *str, struct list *lines)
|
||||
{
|
||||
char *copy = strdup(str);
|
||||
char *pch = strtok(copy, "\n");
|
||||
while (pch != NULL)
|
||||
{
|
||||
list_add_item(lines, (tintptr) pch);
|
||||
pch = strtok(NULL, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
@ -828,7 +842,6 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
||||
self->login_window->left = primary_x_offset - self->login_window->width / 2;
|
||||
self->login_window->top = primary_y_offset - self->login_window->height / 2;
|
||||
|
||||
|
||||
self->login_window->notify = xrdp_wm_login_notify;
|
||||
|
||||
/* if window title not specified, use hostname as default */
|
||||
@ -951,6 +964,51 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
||||
but->top = globals->ls_scaled.input_y_pos;
|
||||
set_string(&but->caption1, "Session");
|
||||
|
||||
/* only display acceptable use policy if requested. */
|
||||
if (globals->ls_acceptable_use_policy_filename[0] != 0)
|
||||
{
|
||||
char *file_path = globals->ls_acceptable_use_policy_filename;
|
||||
int file_size = g_file_get_size(file_path);
|
||||
if (file_size < 1)
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "xrdp_login_wnd_create: error reading data from file [%s]",
|
||||
file_path);
|
||||
return 0;
|
||||
}
|
||||
char *str = (char *)g_malloc(sizeof(char) * (file_size + 1024), 1);
|
||||
int fd = g_file_open(file_path);
|
||||
if (fd != -1)
|
||||
{
|
||||
int b = g_file_read(fd, str, file_size + 1024);
|
||||
g_file_close(fd);
|
||||
|
||||
if (b > 0)
|
||||
{
|
||||
self->acceptable_use_policy_lines = list_create();
|
||||
self->acceptable_use_policy_lines->auto_free = 1;
|
||||
split_string_by_newline(str, self->acceptable_use_policy_lines);
|
||||
|
||||
for (int index = 0; index < self->acceptable_use_policy_lines->count; ++index)
|
||||
{
|
||||
char *text = (char *)list_get_item(self->acceptable_use_policy_lines, index);
|
||||
|
||||
but = xrdp_bitmap_create(globals->ls_scaled.acceptable_use_width,
|
||||
globals->ls_scaled.acceptable_use_row_height,
|
||||
self->screen->bpp, WND_TYPE_LABEL, self);
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
but->left = globals->ls_scaled.acceptable_use_x_pos;
|
||||
but->top = globals->ls_scaled.acceptable_use_y_pos
|
||||
+ (index + 2)
|
||||
* globals->ls_scaled.acceptable_use_row_height;
|
||||
set_string(&but->caption1, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
/* combo */
|
||||
combo = xrdp_bitmap_create(globals->ls_scaled.input_width, combo_height,
|
||||
self->screen->bpp, WND_TYPE_COMBO, self);
|
||||
@ -970,6 +1028,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
||||
list_add_item(self->login_window->child_list, (long)but);
|
||||
but->parent = self->login_window;
|
||||
but->owner = self->login_window;
|
||||
|
||||
but->left = globals->ls_scaled.btn_ok_x_pos;
|
||||
but->top = globals->ls_scaled.btn_ok_y_pos;
|
||||
but->id = 3;
|
||||
@ -1084,6 +1143,10 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
|
||||
globals->ls_unscaled.logo_y_pos = 50;
|
||||
globals->ls_unscaled.label_x_pos = 30;
|
||||
globals->ls_unscaled.label_width = 65;
|
||||
globals->ls_unscaled.acceptable_use_x_pos = 30; /* acceptable use x co-ordinate */
|
||||
globals->ls_unscaled.acceptable_use_y_pos = 240; /* acceptable use y co-ordinate */
|
||||
globals->ls_unscaled.acceptable_use_row_height = 20; /* height of the acceptable use policy */
|
||||
globals->ls_unscaled.acceptable_use_width = 800; /* width of the acceptable use policy */
|
||||
globals->ls_unscaled.input_x_pos = 110;
|
||||
globals->ls_unscaled.input_width = 210;
|
||||
globals->ls_unscaled.input_y_pos = 150;
|
||||
@ -1274,6 +1337,11 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
|
||||
globals->require_credentials = g_text2bool(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "always_show_login_window", 64) == 0)
|
||||
{
|
||||
globals->always_show_login_window = g_text2bool(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "bulk_compression", 64) == 0)
|
||||
{
|
||||
globals->bulk_compression = g_text2bool(v);
|
||||
@ -1331,6 +1399,12 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
|
||||
globals->ls_bg_color = HCOLOR(bpp, xrdp_wm_htoi(v));
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_acceptable_use_policy_filename", 255) == 0)
|
||||
{
|
||||
g_strncpy(globals->ls_acceptable_use_policy_filename, v, 255);
|
||||
globals->ls_acceptable_use_policy_filename[255] = 0;
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_title", 255) == 0)
|
||||
{
|
||||
g_strncpy(globals->ls_title, v, 255);
|
||||
@ -1390,6 +1464,26 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
|
||||
globals->ls_unscaled.label_width = g_atoi(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_acceptable_use_x_pos", 64) == 0)
|
||||
{
|
||||
globals->ls_unscaled.acceptable_use_x_pos = g_atoi(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_acceptable_use_y_pos", 64) == 0)
|
||||
{
|
||||
globals->ls_unscaled.acceptable_use_y_pos = g_atoi(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_acceptable_use_row_height", 64) == 0)
|
||||
{
|
||||
globals->ls_unscaled.acceptable_use_row_height = g_atoi(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_acceptable_use_width", 64) == 0)
|
||||
{
|
||||
globals->ls_unscaled.acceptable_use_width = g_atoi(v);
|
||||
}
|
||||
|
||||
else if (g_strncmp(n, "ls_input_x_pos", 64) == 0)
|
||||
{
|
||||
globals->ls_unscaled.input_x_pos = g_atoi(v);
|
||||
@ -1446,61 +1540,67 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
|
||||
}
|
||||
}
|
||||
|
||||
LOG(LOG_LEVEL_DEBUG, "ini_version: %d", globals->ini_version);
|
||||
LOG(LOG_LEVEL_DEBUG, "use_bitmap_cache: %d", globals->use_bitmap_cache);
|
||||
LOG(LOG_LEVEL_DEBUG, "use_bitmap_compression: %d", globals->use_bitmap_compression);
|
||||
LOG(LOG_LEVEL_DEBUG, "port: %d", globals->port);
|
||||
LOG(LOG_LEVEL_DEBUG, "crypt_level: %d", globals->crypt_level);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_channels: %d", globals->allow_channels);
|
||||
LOG(LOG_LEVEL_DEBUG, "max_bpp: %d", globals->max_bpp);
|
||||
LOG(LOG_LEVEL_DEBUG, "fork: %d", globals->fork);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_nodelay: %d", globals->tcp_nodelay);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_keepalive: %d", globals->tcp_keepalive);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_send_buffer_bytes: %d", globals->tcp_send_buffer_bytes);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_recv_buffer_bytes: %d", globals->tcp_recv_buffer_bytes);
|
||||
LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon);
|
||||
LOG(LOG_LEVEL_DEBUG, "ini_version: %d", globals->ini_version);
|
||||
LOG(LOG_LEVEL_DEBUG, "use_bitmap_cache: %d", globals->use_bitmap_cache);
|
||||
LOG(LOG_LEVEL_DEBUG, "use_bitmap_compression: %d", globals->use_bitmap_compression);
|
||||
LOG(LOG_LEVEL_DEBUG, "port: %d", globals->port);
|
||||
LOG(LOG_LEVEL_DEBUG, "crypt_level: %d", globals->crypt_level);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_channels: %d", globals->allow_channels);
|
||||
LOG(LOG_LEVEL_DEBUG, "max_bpp: %d", globals->max_bpp);
|
||||
LOG(LOG_LEVEL_DEBUG, "fork: %d", globals->fork);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_nodelay: %d", globals->tcp_nodelay);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_keepalive: %d", globals->tcp_keepalive);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_send_buffer_bytes: %d", globals->tcp_send_buffer_bytes);
|
||||
LOG(LOG_LEVEL_DEBUG, "tcp_recv_buffer_bytes: %d", globals->tcp_recv_buffer_bytes);
|
||||
LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon);
|
||||
|
||||
LOG(LOG_LEVEL_DEBUG, "grey: %d", globals->grey);
|
||||
LOG(LOG_LEVEL_DEBUG, "black: %d", globals->black);
|
||||
LOG(LOG_LEVEL_DEBUG, "dark_grey: %d", globals->dark_grey);
|
||||
LOG(LOG_LEVEL_DEBUG, "blue: %d", globals->blue);
|
||||
LOG(LOG_LEVEL_DEBUG, "dark_blue: %d", globals->dark_blue);
|
||||
LOG(LOG_LEVEL_DEBUG, "white: %d", globals->white);
|
||||
LOG(LOG_LEVEL_DEBUG, "red: %d", globals->red);
|
||||
LOG(LOG_LEVEL_DEBUG, "green: %d", globals->green);
|
||||
LOG(LOG_LEVEL_DEBUG, "background: %d", globals->background);
|
||||
LOG(LOG_LEVEL_DEBUG, "grey: %d", globals->grey);
|
||||
LOG(LOG_LEVEL_DEBUG, "black: %d", globals->black);
|
||||
LOG(LOG_LEVEL_DEBUG, "dark_grey: %d", globals->dark_grey);
|
||||
LOG(LOG_LEVEL_DEBUG, "blue: %d", globals->blue);
|
||||
LOG(LOG_LEVEL_DEBUG, "dark_blue: %d", globals->dark_blue);
|
||||
LOG(LOG_LEVEL_DEBUG, "white: %d", globals->white);
|
||||
LOG(LOG_LEVEL_DEBUG, "red: %d", globals->red);
|
||||
LOG(LOG_LEVEL_DEBUG, "green: %d", globals->green);
|
||||
LOG(LOG_LEVEL_DEBUG, "background: %d", globals->background);
|
||||
|
||||
LOG(LOG_LEVEL_DEBUG, "autorun: %s", globals->autorun);
|
||||
LOG(LOG_LEVEL_DEBUG, "hidelogwindow: %d", globals->hidelogwindow);
|
||||
LOG(LOG_LEVEL_DEBUG, "require_credentials: %d", globals->require_credentials);
|
||||
LOG(LOG_LEVEL_DEBUG, "bulk_compression: %d", globals->bulk_compression);
|
||||
LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors);
|
||||
LOG(LOG_LEVEL_DEBUG, "nego_sec_layer: %d", globals->nego_sec_layer);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon);
|
||||
LOG(LOG_LEVEL_DEBUG, "enable_token_login: %d", globals->enable_token_login);
|
||||
LOG(LOG_LEVEL_DEBUG, "autorun: %s", globals->autorun);
|
||||
LOG(LOG_LEVEL_DEBUG, "hidelogwindow: %d", globals->hidelogwindow);
|
||||
LOG(LOG_LEVEL_DEBUG, "require_credentials: %d", globals->require_credentials);
|
||||
LOG(LOG_LEVEL_DEBUG, "always_show_login_window: %d", globals->always_show_login_window);
|
||||
LOG(LOG_LEVEL_DEBUG, "bulk_compression: %d", globals->bulk_compression);
|
||||
LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors);
|
||||
LOG(LOG_LEVEL_DEBUG, "nego_sec_layer: %d", globals->nego_sec_layer);
|
||||
LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon);
|
||||
LOG(LOG_LEVEL_DEBUG, "enable_token_login: %d", globals->enable_token_login);
|
||||
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_top_window_bg_color: %x", globals->ls_top_window_bg_color);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_width (unscaled): %d", globals->ls_unscaled.width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_height (unscaled): %d", globals->ls_unscaled.height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_bg_color: %x", globals->ls_bg_color);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_title: %s", globals->ls_title);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_filename: %s", globals->ls_logo_filename);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_x_pos : %d", globals->ls_unscaled.logo_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_y_pos : %d", globals->ls_unscaled.logo_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_label_x_pos : %d", globals->ls_unscaled.label_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_label_width : %d", globals->ls_unscaled.label_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_x_pos : %d", globals->ls_unscaled.input_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_width : %d", globals->ls_unscaled.input_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_y_pos : %d", globals->ls_unscaled.input_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_x_pos : %d", globals->ls_unscaled.btn_ok_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_y_pos : %d", globals->ls_unscaled.btn_ok_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_width : %d", globals->ls_unscaled.btn_ok_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_height : %d", globals->ls_unscaled.btn_ok_height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_x_pos : %d", globals->ls_unscaled.btn_cancel_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_y_pos : %d", globals->ls_unscaled.btn_cancel_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_width : %d", globals->ls_unscaled.btn_cancel_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_height : %d", globals->ls_unscaled.btn_cancel_height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_top_window_bg_color: %x", globals->ls_top_window_bg_color);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_width (unscaled): %d", globals->ls_unscaled.width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_height (unscaled): %d", globals->ls_unscaled.height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_bg_color: %x", globals->ls_bg_color);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_policy_filename: %s", globals->ls_acceptable_use_policy_filename);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_x_pos: %d", globals->ls_unscaled.acceptable_use_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_y_pos: %d", globals->ls_unscaled.acceptable_use_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_row_height: %d", globals->ls_unscaled.acceptable_use_row_height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_width: %d", globals->ls_unscaled.acceptable_use_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_title: %s", globals->ls_title);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_filename: %s", globals->ls_logo_filename);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_x_pos : %d", globals->ls_unscaled.logo_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_logo_y_pos : %d", globals->ls_unscaled.logo_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_label_x_pos : %d", globals->ls_unscaled.label_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_label_width : %d", globals->ls_unscaled.label_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_x_pos : %d", globals->ls_unscaled.input_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_width : %d", globals->ls_unscaled.input_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_input_y_pos : %d", globals->ls_unscaled.input_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_x_pos : %d", globals->ls_unscaled.btn_ok_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_y_pos : %d", globals->ls_unscaled.btn_ok_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_width : %d", globals->ls_unscaled.btn_ok_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_height : %d", globals->ls_unscaled.btn_ok_height);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_x_pos : %d", globals->ls_unscaled.btn_cancel_x_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_y_pos : %d", globals->ls_unscaled.btn_cancel_y_pos);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_width : %d", globals->ls_unscaled.btn_cancel_width);
|
||||
LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_height : %d", globals->ls_unscaled.btn_cancel_height);
|
||||
|
||||
list_delete(names);
|
||||
list_delete(values);
|
||||
@ -1544,6 +1644,9 @@ xrdp_login_wnd_scale_config_values(struct xrdp_wm *self)
|
||||
LOG(LOG_LEVEL_DEBUG, "Login screen scale factor %f",
|
||||
(float)fheight / DEFAULT_FONT_PIXEL_SIZE);
|
||||
|
||||
#define LOG_SCALED_VALUE(value) \
|
||||
LOG(LOG_LEVEL_INFO, "%s: Unscaled=%d, Scaled=%d", #value, unscaled->value, scaled->value);
|
||||
|
||||
scaled->width = SCALE_AND_ROUND(unscaled->width);
|
||||
scaled->height = SCALE_AND_ROUND(unscaled->height);
|
||||
scaled->logo_width = SCALE_AND_ROUND(unscaled->logo_width);
|
||||
@ -1552,6 +1655,14 @@ xrdp_login_wnd_scale_config_values(struct xrdp_wm *self)
|
||||
scaled->logo_y_pos = SCALE_AND_ROUND(unscaled->logo_y_pos);
|
||||
scaled->label_x_pos = SCALE_AND_ROUND(unscaled->label_x_pos);
|
||||
scaled->label_width = SCALE_AND_ROUND(unscaled->label_width);
|
||||
scaled->acceptable_use_x_pos
|
||||
= SCALE_AND_ROUND(unscaled->acceptable_use_x_pos);
|
||||
scaled->acceptable_use_y_pos
|
||||
= SCALE_AND_ROUND(unscaled->acceptable_use_y_pos);
|
||||
scaled->acceptable_use_row_height
|
||||
= SCALE_AND_ROUND(unscaled->acceptable_use_row_height);
|
||||
scaled->acceptable_use_width
|
||||
= SCALE_AND_ROUND(unscaled->acceptable_use_width);
|
||||
scaled->input_x_pos = SCALE_AND_ROUND(unscaled->input_x_pos);
|
||||
scaled->input_width = SCALE_AND_ROUND(unscaled->input_width);
|
||||
scaled->input_y_pos = SCALE_AND_ROUND(unscaled->input_y_pos);
|
||||
|
||||
@ -505,6 +505,7 @@ struct xrdp_wm
|
||||
/* session log */
|
||||
struct list *log;
|
||||
struct xrdp_bitmap *log_wnd;
|
||||
struct list *acceptable_use_policy_lines;
|
||||
enum wm_login_state login_state;
|
||||
tbus login_state_event;
|
||||
struct xrdp_mm *mm;
|
||||
@ -688,32 +689,36 @@ struct xrdp_startup_params
|
||||
|
||||
struct xrdp_ls_dimensions
|
||||
{
|
||||
int width; /* window width */
|
||||
int height; /* window height */
|
||||
int logo_width; /* logo width (optional) */
|
||||
int logo_height; /* logo height (optional) */
|
||||
int logo_x_pos; /* logo x co-ordinate */
|
||||
int logo_y_pos; /* logo y co-ordinate */
|
||||
int label_x_pos; /* x pos of labels */
|
||||
int label_width; /* width of labels */
|
||||
int input_x_pos; /* x pos of text and combo boxes */
|
||||
int input_width; /* width of input and combo boxes */
|
||||
int input_y_pos; /* y pos for for first label and combo box */
|
||||
int btn_ok_x_pos; /* x pos for OK button */
|
||||
int btn_ok_y_pos; /* y pos for OK button */
|
||||
int btn_ok_width; /* width of OK button */
|
||||
int btn_ok_height; /* height of OK button */
|
||||
int btn_cancel_x_pos; /* x pos for Cancel button */
|
||||
int btn_cancel_y_pos; /* y pos for Cancel button */
|
||||
int btn_cancel_width; /* width of Cancel button */
|
||||
int btn_cancel_height; /* height of Cancel button */
|
||||
int default_btn_height; /* Default button height (e.g. OK on login box) */
|
||||
int log_wnd_width; /* Width of log window */
|
||||
int log_wnd_height; /* Height of log window */
|
||||
int edit_height; /* Height of an edit box */
|
||||
int combo_height; /* Height of a combo box */
|
||||
int help_wnd_width; /* Width of login help window */
|
||||
int help_wnd_height; /* Height of login help window */
|
||||
int width; /* window width */
|
||||
int height; /* window height */
|
||||
int logo_width; /* logo width (optional) */
|
||||
int logo_height; /* logo height (optional) */
|
||||
int logo_x_pos; /* logo x co-ordinate */
|
||||
int logo_y_pos; /* logo y co-ordinate */
|
||||
int label_x_pos; /* x pos of labels */
|
||||
int label_width; /* width of labels */
|
||||
int acceptable_use_x_pos; /* acceptable use x co-ordinate */
|
||||
int acceptable_use_y_pos; /* acceptable use y co-ordinate */
|
||||
int acceptable_use_row_height; /* height of each line in the acceptable use policy */
|
||||
int acceptable_use_width; /* width of the acceptable use policy */
|
||||
int input_x_pos; /* x pos of text and combo boxes */
|
||||
int input_width; /* width of input and combo boxes */
|
||||
int input_y_pos; /* y pos for for first label and combo box */
|
||||
int btn_ok_x_pos; /* x pos for OK button */
|
||||
int btn_ok_y_pos; /* y pos for OK button */
|
||||
int btn_ok_width; /* width of OK button */
|
||||
int btn_ok_height; /* height of OK button */
|
||||
int btn_cancel_x_pos; /* x pos for Cancel button */
|
||||
int btn_cancel_y_pos; /* y pos for Cancel button */
|
||||
int btn_cancel_width; /* width of Cancel button */
|
||||
int btn_cancel_height; /* height of Cancel button */
|
||||
int default_btn_height; /* Default button height (e.g. OK on login box) */
|
||||
int log_wnd_width; /* Width of log window */
|
||||
int log_wnd_height; /* Height of log window */
|
||||
int edit_height; /* Height of an edit box */
|
||||
int combo_height; /* Height of a combo box */
|
||||
int help_wnd_width; /* Width of login help window */
|
||||
int help_wnd_height; /* Height of login help window */
|
||||
};
|
||||
|
||||
struct xrdp_cfg_globals
|
||||
@ -733,6 +738,7 @@ struct xrdp_cfg_globals
|
||||
char autorun[256];
|
||||
int hidelogwindow;
|
||||
int require_credentials;
|
||||
int always_show_login_window;
|
||||
int bulk_compression;
|
||||
int new_cursors;
|
||||
int nego_sec_layer;
|
||||
@ -740,7 +746,6 @@ struct xrdp_cfg_globals
|
||||
int enable_token_login;
|
||||
|
||||
/* colors */
|
||||
|
||||
int grey;
|
||||
int black;
|
||||
int dark_grey;
|
||||
@ -757,6 +762,17 @@ struct xrdp_cfg_globals
|
||||
int ls_top_window_bg_color; /* top level window background color */
|
||||
int ls_bg_color; /* background color */
|
||||
char ls_background_image[256]; /* background image file name */
|
||||
/*
|
||||
filename for acceptable use policy for use in enterprise environments
|
||||
useful in conjunction with always_show_login_window, which forces
|
||||
this policy to be displayed if a filename is specified.
|
||||
|
||||
Note that XRDP's behavior is undefined if an
|
||||
invalid filename is specified.
|
||||
|
||||
https://github.com/neutrinolabs/xrdp/issues/547
|
||||
*/
|
||||
char ls_acceptable_use_policy_filename[256];
|
||||
/* transform to apply to background image */
|
||||
enum xrdp_bitmap_load_transform ls_background_transform;
|
||||
char ls_logo_filename[256]; /* logo filename */
|
||||
|
||||
@ -87,6 +87,8 @@ xrdp_wm_delete(struct xrdp_wm *self)
|
||||
xrdp_bitmap_delete(self->screen);
|
||||
/* free the log */
|
||||
list_delete(self->log);
|
||||
/* free the acceptable use policy */
|
||||
list_delete(self->acceptable_use_policy_lines);
|
||||
/* free default font */
|
||||
xrdp_font_delete(self->default_font);
|
||||
g_delete_wait_obj(self->login_state_event);
|
||||
@ -631,7 +633,8 @@ 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->session->client_info->rdp_autologin
|
||||
&& !self->xrdp_config->cfg_globals.always_show_login_window)
|
||||
{
|
||||
/*
|
||||
* NOTE: this should eventually be accessed from self->xrdp_config
|
||||
@ -2091,6 +2094,28 @@ xrdp_wm_mod_connect_done(struct xrdp_wm *self, int status)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xrdp_wm_paint_text_list(struct xrdp_painter *painter, struct list *text_list,
|
||||
struct xrdp_bitmap *wnd, int text_color, int x, int y)
|
||||
{
|
||||
unsigned int row_height;
|
||||
char *text;
|
||||
|
||||
if (painter == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
row_height = xrdp_painter_font_body_height(painter);
|
||||
painter->fg_color = text_color;
|
||||
|
||||
for (int index = 0; index < text_list->count; ++index)
|
||||
{
|
||||
text = (char *)list_get_item(text_list, index);
|
||||
xrdp_painter_draw_text(painter, wnd, 10,
|
||||
(index + 2) * row_height, text);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* this is the log windows notify function */
|
||||
static int
|
||||
@ -2098,11 +2123,8 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap *wnd,
|
||||
struct xrdp_bitmap *sender,
|
||||
int msg, long param1, long param2)
|
||||
{
|
||||
struct xrdp_painter *painter;
|
||||
struct xrdp_wm *wm;
|
||||
struct xrdp_rect rect;
|
||||
int index;
|
||||
char *text;
|
||||
|
||||
if (wnd == 0)
|
||||
{
|
||||
@ -2141,20 +2163,8 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap *wnd,
|
||||
}
|
||||
else if (msg == WM_PAINT) /* 3 */
|
||||
{
|
||||
painter = (struct xrdp_painter *)param1;
|
||||
|
||||
if (painter != 0)
|
||||
{
|
||||
unsigned int row_height = xrdp_painter_font_body_height(painter);
|
||||
painter->fg_color = wnd->wm->black;
|
||||
|
||||
for (index = 0; index < wnd->wm->log->count; index++)
|
||||
{
|
||||
text = (char *)list_get_item(wnd->wm->log, index);
|
||||
xrdp_painter_draw_text(painter, wnd, 10,
|
||||
(index + 2) * row_height, text);
|
||||
}
|
||||
}
|
||||
xrdp_wm_paint_text_list((struct xrdp_painter *)param1, wnd->wm->log,
|
||||
wnd, wnd->wm->black, 10, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user