Skip to content

Commit 5d4b76a

Browse files
committed
Working on aup screen
1 parent 29ef7f8 commit 5d4b76a

File tree

2 files changed

+67
-25
lines changed

2 files changed

+67
-25
lines changed

xrdp/xrdp_login_wnd.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
828828
self->login_window->left = primary_x_offset - self->login_window->width / 2;
829829
self->login_window->top = primary_y_offset - self->login_window->height / 2;
830830

831-
832831
self->login_window->notify = xrdp_wm_login_notify;
833832

834833
/* if window title not specified, use hostname as default */
@@ -951,6 +950,17 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
951950
but->top = globals->ls_scaled.input_y_pos;
952951
set_string(&but->caption1, "Session");
953952

953+
/* Acceptable Use Policy */
954+
but = xrdp_bitmap_create(globals->ls_scaled.acceptable_use_width, globals->ls_scaled.acceptable_use_height,
955+
self->screen->bpp, WND_TYPE_LABEL, self);
956+
list_add_item(self->login_window->child_list, (long)but);
957+
but->parent = self->login_window;
958+
but->owner = self->login_window;
959+
but->left = globals->ls_scaled.acceptable_use_x_pos;
960+
but->top = globals->ls_scaled.acceptable_use_y_pos;
961+
//set_string(&but->caption1, globals->ls_acceptable_use_policy_filename);
962+
set_string(&but->caption1, "This is a test of adding an acceptable use policy to the login screen");
963+
954964
/* combo */
955965
combo = xrdp_bitmap_create(globals->ls_scaled.input_width, combo_height,
956966
self->screen->bpp, WND_TYPE_COMBO, self);
@@ -1084,6 +1094,10 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
10841094
globals->ls_unscaled.logo_y_pos = 50;
10851095
globals->ls_unscaled.label_x_pos = 30;
10861096
globals->ls_unscaled.label_width = 65;
1097+
globals->ls_unscaled.acceptable_use_x_pos = 30; /* acceptable use x co-ordinate */
1098+
globals->ls_unscaled.acceptable_use_y_pos = 240; /* acceptable use y co-ordinate */
1099+
globals->ls_unscaled.acceptable_use_height = 50; /* height of the acceptable use policy */
1100+
globals->ls_unscaled.acceptable_use_width = 250; /* width of the acceptable use policy */
10871101
globals->ls_unscaled.input_x_pos = 110;
10881102
globals->ls_unscaled.input_width = 210;
10891103
globals->ls_unscaled.input_y_pos = 150;
@@ -1331,6 +1345,12 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
13311345
globals->ls_bg_color = HCOLOR(bpp, xrdp_wm_htoi(v));
13321346
}
13331347

1348+
else if (g_strncmp(n, "ls_acceptable_use_policy_filename", 255) == 0)
1349+
{
1350+
g_strncpy(globals->ls_acceptable_use_policy_filename, v, 255);
1351+
globals->ls_acceptable_use_policy_filename[255] = 0;
1352+
}
1353+
13341354
else if (g_strncmp(n, "ls_title", 255) == 0)
13351355
{
13361356
g_strncpy(globals->ls_title, v, 255);
@@ -1484,6 +1504,7 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp)
14841504
LOG(LOG_LEVEL_DEBUG, "ls_width (unscaled): %d", globals->ls_unscaled.width);
14851505
LOG(LOG_LEVEL_DEBUG, "ls_height (unscaled): %d", globals->ls_unscaled.height);
14861506
LOG(LOG_LEVEL_DEBUG, "ls_bg_color: %x", globals->ls_bg_color);
1507+
LOG(LOG_LEVEL_DEBUG, "ls_acceptable_use_policy_filename: %s", globals->ls_acceptable_use_policy_filename);
14871508
LOG(LOG_LEVEL_DEBUG, "ls_title: %s", globals->ls_title);
14881509
LOG(LOG_LEVEL_DEBUG, "ls_logo_filename: %s", globals->ls_logo_filename);
14891510
LOG(LOG_LEVEL_DEBUG, "ls_logo_x_pos : %d", globals->ls_unscaled.logo_x_pos);
@@ -1552,6 +1573,14 @@ xrdp_login_wnd_scale_config_values(struct xrdp_wm *self)
15521573
scaled->logo_y_pos = SCALE_AND_ROUND(unscaled->logo_y_pos);
15531574
scaled->label_x_pos = SCALE_AND_ROUND(unscaled->label_x_pos);
15541575
scaled->label_width = SCALE_AND_ROUND(unscaled->label_width);
1576+
scaled->acceptable_use_x_pos
1577+
= SCALE_AND_ROUND(unscaled->acceptable_use_x_pos);
1578+
scaled->acceptable_use_y_pos
1579+
= SCALE_AND_ROUND(unscaled->acceptable_use_y_pos);
1580+
scaled->acceptable_use_height
1581+
= SCALE_AND_ROUND(unscaled->acceptable_use_height);
1582+
scaled->acceptable_use_width
1583+
= SCALE_AND_ROUND(unscaled->acceptable_use_width);
15551584
scaled->input_x_pos = SCALE_AND_ROUND(unscaled->input_x_pos);
15561585
scaled->input_width = SCALE_AND_ROUND(unscaled->input_width);
15571586
scaled->input_y_pos = SCALE_AND_ROUND(unscaled->input_y_pos);

xrdp/xrdp_types.h

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -687,30 +687,34 @@ struct xrdp_startup_params
687687

688688
struct xrdp_ls_dimensions
689689
{
690-
int width; /* window width */
691-
int height; /* window height */
692-
int logo_width; /* logo width (optional) */
693-
int logo_height; /* logo height (optional) */
694-
int logo_x_pos; /* logo x co-ordinate */
695-
int logo_y_pos; /* logo y co-ordinate */
696-
int label_x_pos; /* x pos of labels */
697-
int label_width; /* width of labels */
698-
int input_x_pos; /* x pos of text and combo boxes */
699-
int input_width; /* width of input and combo boxes */
700-
int input_y_pos; /* y pos for for first label and combo box */
701-
int btn_ok_x_pos; /* x pos for OK button */
702-
int btn_ok_y_pos; /* y pos for OK button */
703-
int btn_ok_width; /* width of OK button */
704-
int btn_ok_height; /* height of OK button */
705-
int btn_cancel_x_pos; /* x pos for Cancel button */
706-
int btn_cancel_y_pos; /* y pos for Cancel button */
707-
int btn_cancel_width; /* width of Cancel button */
708-
int btn_cancel_height; /* height of Cancel button */
709-
int default_btn_height; /* Default button height (e.g. OK on login box) */
710-
int log_wnd_width; /* Width of log window */
711-
int log_wnd_height; /* Height of log window */
712-
int edit_height; /* Height of an edit box */
713-
int combo_height; /* Height of a combo box */
690+
int width; /* window width */
691+
int height; /* window height */
692+
int logo_width; /* logo width (optional) */
693+
int logo_height; /* logo height (optional) */
694+
int logo_x_pos; /* logo x co-ordinate */
695+
int logo_y_pos; /* logo y co-ordinate */
696+
int label_x_pos; /* x pos of labels */
697+
int label_width; /* width of labels */
698+
int acceptable_use_x_pos; /* acceptable use x co-ordinate */
699+
int acceptable_use_y_pos; /* acceptable use y co-ordinate */
700+
int acceptable_use_height; /* height of the acceptable use policy */
701+
int acceptable_use_width; /* width of the acceptable use policy */
702+
int input_x_pos; /* x pos of text and combo boxes */
703+
int input_width; /* width of input and combo boxes */
704+
int input_y_pos; /* y pos for for first label and combo box */
705+
int btn_ok_x_pos; /* x pos for OK button */
706+
int btn_ok_y_pos; /* y pos for OK button */
707+
int btn_ok_width; /* width of OK button */
708+
int btn_ok_height; /* height of OK button */
709+
int btn_cancel_x_pos; /* x pos for Cancel button */
710+
int btn_cancel_y_pos; /* y pos for Cancel button */
711+
int btn_cancel_width; /* width of Cancel button */
712+
int btn_cancel_height; /* height of Cancel button */
713+
int default_btn_height; /* Default button height (e.g. OK on login box) */
714+
int log_wnd_width; /* Width of log window */
715+
int log_wnd_height; /* Height of log window */
716+
int edit_height; /* Height of an edit box */
717+
int combo_height; /* Height of a combo box */
714718
int help_wnd_width; /* Width of login help window */
715719
int help_wnd_height; /* Height of login help window */
716720
};
@@ -756,6 +760,15 @@ struct xrdp_cfg_globals
756760
int ls_top_window_bg_color; /* top level window background color */
757761
int ls_bg_color; /* background color */
758762
char ls_background_image[256]; /* background image file name */
763+
/*
764+
filename for acceptable use policy for use in enterprise environments
765+
users are required to view this policy on every login.
766+
setting this will implicity disable autologin.
767+
768+
If the file is not found, no sessions will be created.
769+
https://github.com/neutrinolabs/xrdp/issues/547
770+
*/
771+
char ls_acceptable_use_policy_filename[256];
759772
/* transform to apply to background image */
760773
enum xrdp_bitmap_load_transform ls_background_transform;
761774
char ls_logo_filename[256]; /* logo filename */

0 commit comments

Comments
 (0)