Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keypress initiated wipe of VM clipboard #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions gui-daemon/xside.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,41 @@ static int is_special_keypress(Ghandles * g, const XKeyEvent * ev, XID remote_wi

return 1;
}

/* blank */
if (((int)ev->state & SPECIAL_KEYS_MASK) == g->blank_seq_mask
&& ev->keycode == XKeysymToKeycode(g->display, g->blank_seq_key)) {
if (ev->type != KeyPress)
return 1;
inter_appviewer_lock(g, 1);
clipboard_file_xevent_time = get_clipboard_file_xevent_timestamp();
if (clipboard_file_xevent_time > ev->time) {
/* some other clipboard operation happened in the meantime, discard
* request */
inter_appviewer_lock(g, 0);
fprintf(stderr,
"received clipboard xevent after some other clipboard op, discarding\n");
return 1;
}
if (g->qrexec_clipboard) {
if (g->log_level > 0)
fprintf(stderr, "secure blank is not supported for stubdom GUI\n");
} else {
hdr.type = MSG_CLIPBOARD_DATA;
if (g->log_level > 0)
fprintf(stderr, "secure blank\n");
len = 0;
/* MSG_CLIPBOARD_DATA uses the window field to pass the length
of the blob */
hdr.window = len;
hdr.untrusted_len = len;
real_write_message(g->vchan, (char *) &hdr, sizeof(hdr),
data, len);
}
inter_appviewer_lock(g, 0);

return 1;
}
return 0;
}

Expand Down Expand Up @@ -3177,6 +3212,8 @@ static void load_default_config_values(Ghandles * g)
g->copy_seq_key = XK_c;
g->paste_seq_mask = ControlMask | ShiftMask;
g->paste_seq_key = XK_v;
g->blank_seq_mask = ControlMask | ShiftMask;
g->blank_seq_key = XK_b;
g->allow_fullscreen = 0;
g->startup_timeout = 45;
g->audio_low_latency = 1;
Expand Down Expand Up @@ -3246,6 +3283,11 @@ static void parse_vm_config(Ghandles * g, config_setting_t * group)
parse_key_sequence(config_setting_get_string(setting),
&g->paste_seq_mask, &g->paste_seq_key);
}
if ((setting =
config_setting_get_member(group, "secure_blank_sequence"))) {
parse_key_sequence(config_setting_get_string(setting),
&g->blank_seq_mask, &g->blank_seq_key);
}

if ((setting =
config_setting_get_member(group, "allow_utf8_titles"))) {
Expand Down
2 changes: 2 additions & 0 deletions gui-daemon/xside.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ struct _global_handles {
KeySym copy_seq_key; /* key for secure-copy key sequence */
int paste_seq_mask; /* modifiers mask for secure-paste key sequence */
KeySym paste_seq_key; /* key for secure-paste key sequence */
int blank_seq_mask; /* modifiers mask for secure-paste key sequence */
KeySym blank_seq_key; /* key for secure-paste key sequence */
int qrexec_clipboard; /* 0: use GUI protocol to fetch/put clipboard, 1: use qrexec */
int use_kdialog; /* use kdialog for prompts (default on KDE) or zenity (default on non-KDE) */
int audio_low_latency; /* set low-latency mode while starting pacat-simple-vchan */
Expand Down