The manpage recommends using absolute paths for commands, but those
won't work. :) This patch makes everything not in a list of special
characters to be a part of word; this way you can easily put
the following in doas.conf:

  permit :somepeople cmd /usr/bin/mail [email protected]

The next step will be quotes support, I think?

--
WBR,
  Vadim Zhukov


Index: parse.y
===================================================================
RCS file: /cvs/src/usr.bin/doas/parse.y,v
retrieving revision 1.1
diff -u -p -r1.1 parse.y
--- parse.y     16 Jul 2015 20:44:21 -0000      1.1
+++ parse.y     16 Jul 2015 21:52:46 -0000
@@ -183,19 +183,24 @@ yylex(void)
                        return c;
                case EOF:
                        return 0;
-               case ':':
-                       *p++ = c;
-                       c = getc(yyfp);
-                       break;
-               default:
-                       break;
        }
-       while (isalnum(c)) {
+       while (1) {
+               switch (c) {
+               case '\n':
+               case '{':
+               case '}':
+               case '#':
+               case ' ':
+               case '\t':
+               case EOF:
+                       goto eow;
+               }
                *p++ = c;
                if (p == ebuf)
                        yyerror("too much stuff");
                c = getc(yyfp);
        }
+eow:
        *p = 0;
        if (c != EOF)
                ungetc(c, yyfp);

Reply via email to