Read sesman config in clipboard
This commit is contained in:
parent
751cd97018
commit
46c33ddaf4
@ -230,7 +230,7 @@ static char g_bmp_image_header[] =
|
||||
|
||||
extern int g_cliprdr_chan_id; /* in chansrv.c */
|
||||
|
||||
struct config_sesman g_cfg /* config.h */
|
||||
struct config_sesman *g_cfg; /* config.h */
|
||||
|
||||
extern Display *g_display; /* in xcommon.c */
|
||||
extern int g_x_socket; /* in xcommon.c */
|
||||
@ -381,16 +381,24 @@ clipboard_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (0 != config_read(&g_cfg))
|
||||
{
|
||||
g_printf("clipboard: error reading config. quitting.\n");
|
||||
return 1;
|
||||
}
|
||||
/* reading config */
|
||||
g_cfg = g_new0(struct config_sesman, 1);
|
||||
|
||||
log_debug("clipboard_init: outbound clipboard restricted -> " + g_cfg.sec.restrict_oubound_clipboard)
|
||||
//one-way clipboard
|
||||
g_outbound_clipboard_restricted = g_cfg.sec.restrict_oubound_clipboard;
|
||||
if (0 == g_cfg)
|
||||
{
|
||||
g_printf("error creating config: quitting.\n");
|
||||
g_deinit();
|
||||
g_exit(1);
|
||||
}
|
||||
|
||||
if (0 != config_read(g_cfg))
|
||||
{
|
||||
log_error("clipboard: error reading config. quitting.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
//one-way clipboard
|
||||
g_outbound_clipboard_restricted = g_cfg->sec.restrict_outbound_clipboard;
|
||||
|
||||
xfuse_init();
|
||||
xcommon_init();
|
||||
@ -2513,13 +2521,14 @@ clipboard_xevent(void *xevent)
|
||||
switch (lxevent->type)
|
||||
{
|
||||
case SelectionNotify:
|
||||
if (g_outbound_clipboard_restricted == 0) {
|
||||
log_debug("clipboard_xevent: clipboard SelectionNotify event on xorg.")
|
||||
clipboard_event_selection_notify(lxevent);
|
||||
} else {
|
||||
log_debug("clipboard_xevent: clipboard restricted, ignoring xorg event.")
|
||||
return 1;
|
||||
}
|
||||
if (g_outbound_clipboard_restricted == 0)
|
||||
{
|
||||
clipboard_event_selection_notify(lxevent);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case SelectionRequest:
|
||||
clipboard_event_selection_request(lxevent);
|
||||
|
1
sesman/chansrv/config.c
Normal file
1
sesman/chansrv/config.c
Normal file
@ -0,0 +1 @@
|
||||
#include "../config.c"
|
@ -235,7 +235,7 @@ config_read_security(int file, struct config_security *sc,
|
||||
sc->login_retry = 3;
|
||||
sc->ts_users_enable = 0;
|
||||
sc->ts_admins_enable = 0;
|
||||
sc->restrict_oubound_clipboard = 0;
|
||||
sc->restrict_outbound_clipboard = 0;
|
||||
|
||||
file_read_section(file, SESMAN_CFG_SECURITY, param_n, param_v);
|
||||
|
||||
@ -274,10 +274,10 @@ config_read_security(int file, struct config_security *sc,
|
||||
{
|
||||
sc->ts_always_group_check = g_text2bool((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
||||
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_RESTRICT_CLIPBOARD))
|
||||
{
|
||||
sc->restrict_oubound_clipboard = g_text2bool((char *)list_get_item(param_v, i));
|
||||
sc->restrict_outbound_clipboard = g_text2bool((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
||||
|
||||
@ -505,7 +505,7 @@ config_dump(struct config_sesman *config)
|
||||
g_writeln(" AllowRootLogin: %d", sc->allow_root);
|
||||
g_writeln(" MaxLoginRetry: %d", sc->login_retry);
|
||||
g_writeln(" AlwaysGroupCheck: %d", sc->ts_always_group_check);
|
||||
g_printf("\tRestrictOutboundClipboard: %i\r\n", sc->restrict_oubound_clipboard);
|
||||
g_writeln(" RestrictOutboundClipboard: %d", sc->restrict_outbound_clipboard);
|
||||
|
||||
g_printf( " TSUsersGroup: ");
|
||||
if (sc->ts_users_enable)
|
||||
|
@ -60,6 +60,7 @@
|
||||
#define SESMAN_CFG_SEC_USR_GROUP "TerminalServerUsers"
|
||||
#define SESMAN_CFG_SEC_ADM_GROUP "TerminalServerAdmins"
|
||||
#define SESMAN_CFG_SEC_ALWAYSGROUPCHECK "AlwaysGroupCheck"
|
||||
#define SESMAN_CFG_RESTRICT_CLIPBOARD "RestrictOutboundClipboard"
|
||||
|
||||
#define SESMAN_CFG_SESSIONS "Sessions"
|
||||
#define SESMAN_CFG_SESS_MAX "MaxSessions"
|
||||
@ -127,10 +128,10 @@ struct config_security
|
||||
*/
|
||||
int ts_always_group_check;
|
||||
/**
|
||||
* @var restrict_oubound_clipboard
|
||||
* @var restrict_outbound_clipboard
|
||||
* @brief if the clipboard should be enforced restricted. If true only allow client -> server, not vice versa.
|
||||
*/
|
||||
int restrict_oubound_clipboard;
|
||||
int restrict_outbound_clipboard;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user