opendoas

A portable version of the OpenBSD `doas` command
git clone https://pi.duncano.de/git/opendoas.git
Log | Files | Refs | README | LICENSE

commit 135b26bc13338163773b613e459bdac850927ae9
parent d22ea3dc8bd52907291af8b41b33260ca74a1e69
Author: Vadim Zhukov <zhuk@openbsd.org>
Date:   Thu, 16 Jul 2015 22:33:01 +0000

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@

Diffstat:
parse.y | 21+++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git 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);