aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Zhukov <zhuk@openbsd.org>2015-07-16 22:33:01 +0000
committerVadim Zhukov <zhuk@openbsd.org>2015-07-16 22:33:01 +0000
commit135b26bc13338163773b613e459bdac850927ae9 (patch)
tree868543f8648fb01c9d64efdb830c1bb4d6d639c4
parentd22ea3dc8bd52907291af8b41b33260ca74a1e69 (diff)
downloadopendoas-135b26bc13338163773b613e459bdac850927ae9.tar.gz
Allow (almost) any non-space character to be a part of "word" in doas.conf.
This allows weird commands like /bin/echo to be used for real. No command arguments handling yet, though, as well as quoting. okay tedu@
-rw-r--r--parse.y21
1 files changed, 13 insertions, 8 deletions
diff --git a/parse.y b/parse.y
index 1b3a542..d35f386 100644
--- 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);