diff options
author | 2015-07-16 22:33:01 +0000 | |
---|---|---|
committer | 2015-07-16 22:33:01 +0000 | |
commit | f83af9213678e9e04642b8a6d2195ecd102a3fd8 (patch) | |
tree | a487fe256c1fe1f358c25be74fd4ace7aaf31d4d | |
parent | Missing reallocarray check in doas.c (ok tedu) and a calloc in parse.y (diff) | |
download | wireguard-openbsd-f83af9213678e9e04642b8a6d2195ecd102a3fd8.tar.xz wireguard-openbsd-f83af9213678e9e04642b8a6d2195ecd102a3fd8.zip |
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-- | usr.bin/doas/parse.y | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/usr.bin/doas/parse.y b/usr.bin/doas/parse.y index f55d58b60cf..80d1e0bb207 100644 --- a/usr.bin/doas/parse.y +++ b/usr.bin/doas/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.2 2015/07/16 22:11:01 nicm Exp $ */ +/* $OpenBSD: parse.y,v 1.3 2015/07/16 22:33:01 zhuk 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); |