disallow switching of VTs.

This commit is contained in:
Christopher Jeffrey 2014-07-30 13:02:56 -07:00
parent e8963dec40
commit 9fd0ec8074

16
slock.c
View File

@ -189,6 +189,22 @@ readpw(Display *dpy, const char *pws)
if(len) if(len)
--len; --len;
break; break;
case XK_Alt_L:
case XK_Alt_R:
case XK_Control_L:
case XK_Control_R:
case XK_F1:
case XK_F2:
case XK_F3:
case XK_F4:
case XK_F5:
case XK_F6:
case XK_F7: {
// Needs sudo privileges for systemctl
char *args[] = { "sudo", "systemctl", "poweroff", NULL };
execvp("sudo", args);
// fall-through if we fail
}
default: default:
if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
memcpy(passwd + len, buf, num); memcpy(passwd + len, buf, num);