[PATCH] setkeys needs root

This patch combines commit 0b360adbdb (make
setkeys root-only) and commit e3f17f0f6e (only
disallow setting by users)

   Because people can play games reprogramming keys and leaving traps for the
   next user of the console.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Daniel Drake 2005-12-02 20:56:21 +00:00 committed by Greg Kroah-Hartman
parent bb4828a25f
commit 6ca4c553e6

View file

@ -80,6 +80,9 @@ do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_str
if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry)))
return -EFAULT;
if (!capable(CAP_SYS_TTY_CONFIG))
perm = 0;
switch (cmd) {
case KDGKBENT:
key_map = key_maps[s];
@ -192,6 +195,9 @@ do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
int i, j, k;
int ret;
if (!capable(CAP_SYS_TTY_CONFIG))
perm = 0;
kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
if (!kbs) {
ret = -ENOMEM;