Hi,

I noticed that kbd(8) lets you list all available keyboard encodings
with the -l flag.  However, we get no error and no list unless we're
running this as root.  I apologize if this is intended and I fail to
understand why.  If not intended, the patch below will check if we're
root or otherwise error out.


Jesper Wallin


Index: sbin/kbd/main.c
===================================================================
RCS file: /cvs/src/sbin/kbd/main.c,v
retrieving revision 1.8
diff -u -p -r1.8 main.c
--- sbin/kbd/main.c     30 Dec 2007 13:50:43 -0000      1.8
+++ sbin/kbd/main.c     29 Aug 2017 18:40:27 -0000
@@ -32,6 +32,7 @@
  * SUCH DAMAGE.
  */
 
+#include <err.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -68,6 +69,9 @@ main(int argc, char *argv[])
                }
        if (argc != optind + list_tables ? 0 : 1)
                usage();
+
+       if (geteuid() != 0)
+               errx(1, "need root privileges");
 
        if (list_tables)
                kbd_list();

Reply via email to