]> git.armaanb.net Git - opendoas.git/commitdiff
Allow (almost) any non-space character to be a part of "word" in doas.conf.
authorVadim Zhukov <zhuk@openbsd.org>
Thu, 16 Jul 2015 22:33:01 +0000 (22:33 +0000)
committerVadim Zhukov <zhuk@openbsd.org>
Thu, 16 Jul 2015 22:33:01 +0000 (22:33 +0000)
This allows weird commands like /bin/echo to be used for real. No command
arguments handling yet, though, as well as quoting.

okay tedu@

parse.y

diff --git a/parse.y b/parse.y
index 1b3a54261e908e95f11f3707fe4420bff70c20ef..d35f38688ec65e6718f86648fe6b2e3621c0fa6b 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.1 2015/07/16 20:44:21 tedu Exp $ */
+/* $OpenBSD: parse.y,v 1.2 2015/07/16 22:11:01 nicm Exp $ */
 /*
  * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
  *
@@ -185,19 +185,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);