Display more specific parser error messages when possible.
This commit is contained in:
@@ -180,7 +180,7 @@ find_default(const char *name, const char *file, int lineno, bool quiet)
|
|||||||
}
|
}
|
||||||
if (!quiet && !def_ignore_unknown_defaults) {
|
if (!quiet && !def_ignore_unknown_defaults) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d unknown defaults entry \"%s\""),
|
sudo_warnx(U_("%s:%d: unknown defaults entry \"%s\""),
|
||||||
file, lineno, name);
|
file, lineno, name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: unknown defaults entry \"%s\""),
|
sudo_warnx(U_("%s: unknown defaults entry \"%s\""),
|
||||||
@@ -204,7 +204,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
int rc;
|
int rc;
|
||||||
debug_decl(parse_default_entry, SUDOERS_DEBUG_DEFAULTS);
|
debug_decl(parse_default_entry, SUDOERS_DEBUG_DEFAULTS);
|
||||||
|
|
||||||
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %s:%d %s=%s op=%d",
|
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: %s:%d: %s=%s op=%d",
|
||||||
__func__, file, lineno, def->name, val ? val : "", op);
|
__func__, file, lineno, def->name, val ? val : "", op);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -229,7 +229,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
if (!ISSET(def->type, T_BOOL) || op != false) {
|
if (!ISSET(def->type, T_BOOL) || op != false) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d no value specified for \"%s\""),
|
sudo_warnx(U_("%s:%d: no value specified for \"%s\""),
|
||||||
file, lineno, def->name);
|
file, lineno, def->name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: no value specified for \"%s\""),
|
sudo_warnx(U_("%s: no value specified for \"%s\""),
|
||||||
@@ -252,7 +252,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
if (ISSET(def->type, T_PATH) && val != NULL && *val != '/') {
|
if (ISSET(def->type, T_PATH) && val != NULL && *val != '/') {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d values for \"%s\" must start with a '/'"),
|
sudo_warnx(U_("%s:%d: values for \"%s\" must start with a '/'"),
|
||||||
file, lineno, def->name);
|
file, lineno, def->name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: values for \"%s\" must start with a '/'"),
|
sudo_warnx(U_("%s: values for \"%s\" must start with a '/'"),
|
||||||
@@ -277,7 +277,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
if (val != NULL) {
|
if (val != NULL) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d option \"%s\" does not take a value"),
|
sudo_warnx(U_("%s:%d: option \"%s\" does not take a value"),
|
||||||
file, lineno, def->name);
|
file, lineno, def->name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: option \"%s\" does not take a value"),
|
sudo_warnx(U_("%s: option \"%s\" does not take a value"),
|
||||||
@@ -305,7 +305,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
default:
|
default:
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d invalid Defaults type 0x%x for option \"%s\""),
|
sudo_warnx(U_("%s:%d: invalid Defaults type 0x%x for option \"%s\""),
|
||||||
file, lineno, def->type, def->name);
|
file, lineno, def->type, def->name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: invalid Defaults type 0x%x for option \"%s\""),
|
sudo_warnx(U_("%s: invalid Defaults type 0x%x for option \"%s\""),
|
||||||
@@ -318,7 +318,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
|
|||||||
if (rc == false) {
|
if (rc == false) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (lineno > 0) {
|
if (lineno > 0) {
|
||||||
sudo_warnx(U_("%s:%d value \"%s\" is invalid for option \"%s\""),
|
sudo_warnx(U_("%s:%d: value \"%s\" is invalid for option \"%s\""),
|
||||||
file, lineno, val, def->name);
|
file, lineno, val, def->name);
|
||||||
} else {
|
} else {
|
||||||
sudo_warnx(U_("%s: value \"%s\" is invalid for option \"%s\""),
|
sudo_warnx(U_("%s: value \"%s\" is invalid for option \"%s\""),
|
||||||
|
@@ -719,8 +719,16 @@ int yyparse(void);
|
|||||||
void
|
void
|
||||||
sudoerserror(const char *s)
|
sudoerserror(const char *s)
|
||||||
{
|
{
|
||||||
|
static int last_error_line = -1;
|
||||||
|
static char *last_error_file = NULL;
|
||||||
debug_decl(sudoerserror, SUDOERS_DEBUG_PARSER);
|
debug_decl(sudoerserror, SUDOERS_DEBUG_PARSER);
|
||||||
|
|
||||||
|
/* Avoid displaying a generic error after a more specific one. */
|
||||||
|
if (last_error_file == sudoers && last_error_line == this_lineno)
|
||||||
|
debug_return;
|
||||||
|
last_error_file = sudoers;
|
||||||
|
last_error_line = this_lineno;
|
||||||
|
|
||||||
/* Save the line the first error occurred on. */
|
/* Save the line the first error occurred on. */
|
||||||
if (errorlineno == -1) {
|
if (errorlineno == -1) {
|
||||||
errorlineno = this_lineno;
|
errorlineno = this_lineno;
|
||||||
@@ -731,12 +739,12 @@ sudoerserror(const char *s)
|
|||||||
LEXTRACE("<*> ");
|
LEXTRACE("<*> ");
|
||||||
#ifndef TRACELEXER
|
#ifndef TRACELEXER
|
||||||
if (trace_print == NULL || trace_print == sudoers_trace_print) {
|
if (trace_print == NULL || trace_print == sudoers_trace_print) {
|
||||||
const char fmt[] = ">>> %s: %s near line %d <<<\n";
|
|
||||||
int oldlocale;
|
int oldlocale;
|
||||||
|
|
||||||
/* Warnings are displayed in the user's locale. */
|
/* Warnings are displayed in the user's locale. */
|
||||||
sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
|
sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
|
||||||
sudo_printf(SUDO_CONV_ERROR_MSG, _(fmt), sudoers, _(s), this_lineno);
|
sudo_printf(SUDO_CONV_ERROR_MSG, _("%s:%d: %s\n"), sudoers,
|
||||||
|
this_lineno, _(s));
|
||||||
sudoers_setlocale(oldlocale, NULL);
|
sudoers_setlocale(oldlocale, NULL);
|
||||||
|
|
||||||
/* Display the offending line and token if possible. */
|
/* Display the offending line and token if possible. */
|
||||||
@@ -1183,7 +1191,7 @@ init_options(struct command_options *opts)
|
|||||||
opts->limitprivs = NULL;
|
opts->limitprivs = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#line 1129 "gram.c"
|
#line 1137 "gram.c"
|
||||||
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
|
||||||
static int yygrowstack(void)
|
static int yygrowstack(void)
|
||||||
{
|
{
|
||||||
@@ -2332,7 +2340,7 @@ case 120:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#line 2278 "gram.c"
|
#line 2286 "gram.c"
|
||||||
}
|
}
|
||||||
yyssp -= yym;
|
yyssp -= yym;
|
||||||
yystate = *yyssp;
|
yystate = *yyssp;
|
||||||
|
@@ -933,8 +933,16 @@ group : ALIAS {
|
|||||||
void
|
void
|
||||||
sudoerserror(const char *s)
|
sudoerserror(const char *s)
|
||||||
{
|
{
|
||||||
|
static int last_error_line = -1;
|
||||||
|
static char *last_error_file = NULL;
|
||||||
debug_decl(sudoerserror, SUDOERS_DEBUG_PARSER);
|
debug_decl(sudoerserror, SUDOERS_DEBUG_PARSER);
|
||||||
|
|
||||||
|
/* Avoid displaying a generic error after a more specific one. */
|
||||||
|
if (last_error_file == sudoers && last_error_line == this_lineno)
|
||||||
|
debug_return;
|
||||||
|
last_error_file = sudoers;
|
||||||
|
last_error_line = this_lineno;
|
||||||
|
|
||||||
/* Save the line the first error occurred on. */
|
/* Save the line the first error occurred on. */
|
||||||
if (errorlineno == -1) {
|
if (errorlineno == -1) {
|
||||||
errorlineno = this_lineno;
|
errorlineno = this_lineno;
|
||||||
@@ -945,12 +953,12 @@ sudoerserror(const char *s)
|
|||||||
LEXTRACE("<*> ");
|
LEXTRACE("<*> ");
|
||||||
#ifndef TRACELEXER
|
#ifndef TRACELEXER
|
||||||
if (trace_print == NULL || trace_print == sudoers_trace_print) {
|
if (trace_print == NULL || trace_print == sudoers_trace_print) {
|
||||||
const char fmt[] = ">>> %s: %s near line %d <<<\n";
|
|
||||||
int oldlocale;
|
int oldlocale;
|
||||||
|
|
||||||
/* Warnings are displayed in the user's locale. */
|
/* Warnings are displayed in the user's locale. */
|
||||||
sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
|
sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale);
|
||||||
sudo_printf(SUDO_CONV_ERROR_MSG, _(fmt), sudoers, _(s), this_lineno);
|
sudo_printf(SUDO_CONV_ERROR_MSG, _("%s:%d: %s\n"), sudoers,
|
||||||
|
this_lineno, _(s));
|
||||||
sudoers_setlocale(oldlocale, NULL);
|
sudoers_setlocale(oldlocale, NULL);
|
||||||
|
|
||||||
/* Display the offending line and token if possible. */
|
/* Display the offending line and token if possible. */
|
||||||
|
@@ -161,7 +161,7 @@ sudoers_lookup_check(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
*matching_cs = cs;
|
*matching_cs = cs;
|
||||||
*defs = &priv->defaults;
|
*defs = &priv->defaults;
|
||||||
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
|
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
|
||||||
"userspec matched @ %s:%d %s",
|
"userspec matched @ %s:%d: %s",
|
||||||
us->file ? us->file : "???", us->lineno,
|
us->file ? us->file : "???", us->lineno,
|
||||||
cmnd_match ? "allowed" : "denied");
|
cmnd_match ? "allowed" : "denied");
|
||||||
debug_return_int(cmnd_match);
|
debug_return_int(cmnd_match);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
user1 ALL = LOG_INPUT: LOG_OUTPUT: /usr/bin/su - : ALL = NOLOG_INPUT: NOLOG_OUTPUT: /usr/bin/id
|
user1 ALL = LOG_INPUT: LOG_OUTPUT: /usr/bin/su - : ALL = NOLOG_INPUT: NOLOG_OUTPUT: /usr/bin/id
|
||||||
user2 ALL = SETENV: NOEXEC: NOPASSWD: /usr/bin/vi : ALL = NOSETENV: EXEC: PASSWD: /usr/bin/echo
|
user2 ALL = SETENV: NOEXEC: NOPASSWD: /usr/bin/vi : ALL = NOSETENV: EXEC: PASSWD: /usr/bin/echo
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Cmnd_Alias LS = sha224:d06a2617c98d377c250edd470fd5e576327748d82915d6e33b5f8db1, sha224:d7910e1967342b4605cb73a550944044c631cd3514001900966962ac /bin/ls
|
Cmnd_Alias LS = sha224:d06a2617c98d377c250edd470fd5e576327748d82915d6e33b5f8db1, sha224:d7910e1967342b4605cb73a550944044c631cd3514001900966962ac /bin/ls
|
||||||
Cmnd_Alias SH = sha256:hOtoe/iK6SlGg7w4BfZBBdSsXjUmTJ5+ts51yjh7vkM=, sha256:1IXHRCxXgSnIEnb+xBz4PAfWaPdXIBWKFF0QCwxJ5G4= /bin/sh
|
Cmnd_Alias SH = sha256:hOtoe/iK6SlGg7w4BfZBBdSsXjUmTJ5+ts51yjh7vkM=, sha256:1IXHRCxXgSnIEnb+xBz4PAfWaPdXIBWKFF0QCwxJ5G4= /bin/sh
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
user ALL = sudoedit /etc/motd
|
user ALL = sudoedit /etc/motd
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Cmnd_Alias EDIT = sudoedit /etc/motd
|
Cmnd_Alias EDIT = sudoedit /etc/motd
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults command_timeout=2d8h10m59s
|
Defaults command_timeout=2d8h10m59s
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parse error in sudoers near line 4 (problem with defaults entries).
|
Problem with defaults entries
|
||||||
|
|
||||||
Defaults command_timeout=2d8h10m59ss
|
Defaults command_timeout=2d8h10m59ss
|
||||||
Defaults:root command_timeout=15f
|
Defaults:root command_timeout=15f
|
||||||
|
@@ -6,5 +6,5 @@ WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
|||||||
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
||||||
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
||||||
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
WORD(5) ALL = CMND_TIMEOUT = WORD(5) <*> COMMAND
|
||||||
testsudoers: sudoers:2 value "2d8h10m59ss" is invalid for option "command_timeout"
|
testsudoers: sudoers:2: value "2d8h10m59ss" is invalid for option "command_timeout"
|
||||||
testsudoers: sudoers:3 value "15f" is invalid for option "command_timeout"
|
testsudoers: sudoers:3: value "15f" is invalid for option "command_timeout"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
user0 ALL = NOTBEFORE=20170214083000Z NOTAFTER=20170301083000Z /usr/bin/id, /bin/ls
|
user0 ALL = NOTBEFORE=20170214083000Z NOTAFTER=20170301083000Z /usr/bin/id, /bin/ls
|
||||||
user1 ALL = NOTBEFORE=20170214083000Z /usr/bin/id, NOTAFTER=20170301083000Z /bin/ls
|
user1 ALL = NOTBEFORE=20170214083000Z /usr/bin/id, NOTAFTER=20170301083000Z /bin/ls
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults@somehost set_home
|
Defaults@somehost set_home
|
||||||
Defaults@quoted\" set_home
|
Defaults@quoted\" set_home
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults lecture
|
Defaults lecture
|
||||||
Defaults !lecture
|
Defaults !lecture
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults syslog
|
Defaults syslog
|
||||||
Defaults !syslog
|
Defaults !syslog
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
user1 ALL = (root) ALL
|
user1 ALL = (root) ALL
|
||||||
user2 ALL = (root) ALL
|
user2 ALL = (root) ALL
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults env_check="COLORTERM LANG LANGUAGE LC_* LINGUAS"
|
Defaults env_check="COLORTERM LANG LANGUAGE LC_* LINGUAS"
|
||||||
Defaults env_check+="TERM TZ"
|
Defaults env_check+="TERM TZ"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults:FOO env_reset
|
Defaults:FOO env_reset
|
||||||
Defaults:foo, bar env_reset
|
Defaults:foo, bar env_reset
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
Parse error in sudoers near line 7.
|
|
||||||
|
|
||||||
User_Alias BAR = bar
|
User_Alias BAR = bar
|
||||||
User_Alias FOO = foo
|
User_Alias FOO = foo
|
||||||
|
@@ -2,4 +2,4 @@
|
|||||||
USERALIAS ALIAS = WORD(5) : ALIAS = WORD(5)
|
USERALIAS ALIAS = WORD(5) : ALIAS = WORD(5)
|
||||||
|
|
||||||
#
|
#
|
||||||
USERALIAS ALIAS = WORD(5) ERROR <*> ALIAS = WORD(5)
|
USERALIAS ALIAS = WORD(5) <*> ERROR ALIAS = WORD(5)
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
Parse error in sudoers near line 2.
|
|
||||||
|
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
USERALIAS ALIAS = BEGINSTR ENDSTR ERROR <*>
|
USERALIAS ALIAS = BEGINSTR ENDSTR <*> ERROR
|
||||||
BEGINSTR ENDSTR ERROR <*> ALL = ALL
|
BEGINSTR ENDSTR ERROR <*> ALL = ALL
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Defaults:#123 set_home
|
Defaults:#123 set_home
|
||||||
Defaults>#123 set_home
|
Defaults>#123 set_home
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
Parse error in sudoers near line 2.
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR ERROR <*>
|
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR <*> ERROR
|
||||||
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR ERROR <*>
|
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR <*> ERROR
|
||||||
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR ERROR <*>
|
USERALIAS ALIAS = BEGINSTR STRBODY ENDSTR <*> ERROR
|
||||||
USERALIAS ALIAS = ERROR <*>
|
USERALIAS ALIAS = <*> ERROR
|
||||||
USERALIAS ALIAS = ERROR <*>
|
USERALIAS ALIAS = <*> ERROR
|
||||||
USERALIAS ALIAS = ERROR <*>
|
USERALIAS ALIAS = <*> ERROR
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
Parse error in sudoers near line 8.
|
|
||||||
|
|
||||||
User_Alias UA1 = xy
|
User_Alias UA1 = xy
|
||||||
User_Alias UA2 = xy
|
User_Alias UA2 = xy
|
||||||
|
@@ -4,4 +4,4 @@ USERALIAS ALIAS = BEGINSTR STRBODY STRBODY ENDSTR WORD(4)
|
|||||||
USERALIAS ALIAS = WORD(5)
|
USERALIAS ALIAS = WORD(5)
|
||||||
|
|
||||||
#
|
#
|
||||||
USERALIAS ALIAS = BEGINSTR STRBODY ERROR <*> ERROR
|
USERALIAS ALIAS = BEGINSTR STRBODY <*> ERROR ERROR
|
@@ -1,2 +1,2 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
Testing @include of a path with escaped white space
|
Testing @include of a path with escaped white space
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing @include of a double-quoted path with white space
|
Testing @include of a double-quoted path with white space
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #include of a path with escaped white space
|
Testing #include of a path with escaped white space
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #include of a double-quoted path with white space
|
Testing #include of a double-quoted path with white space
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
Testing @include with garbage after the path name
|
Testing @include with garbage after the path name
|
||||||
|
|
||||||
>>> sudoers: syntax error near line 1 <<<
|
sudoers:1: syntax error
|
||||||
@include ../../../trunk/plugins/sudoers/regress/testsudoers/test2.inc womp womp
|
@include ../../../trunk/plugins/sudoers/regress/testsudoers/test2.inc womp womp
|
||||||
^
|
^
|
||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -16,10 +15,9 @@ Command allowed
|
|||||||
|
|
||||||
Testing #include with garbage after the path name
|
Testing #include with garbage after the path name
|
||||||
|
|
||||||
>>> sudoers: syntax error near line 1 <<<
|
sudoers:1: syntax error
|
||||||
#include ../../../trunk/plugins/sudoers/regress/testsudoers/test2.inc womp womp
|
#include ../../../trunk/plugins/sudoers/regress/testsudoers/test2.inc womp womp
|
||||||
^
|
^
|
||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
Testing @include
|
Testing @include
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #include
|
Testing #include
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
Testing @includedir of an unquoted path
|
Testing @includedir of an unquoted path
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing @includedir of a double-quoted path
|
Testing @includedir of a double-quoted path
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #includedir of an unquoted path
|
Testing #includedir of an unquoted path
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #includedir of a double-quoted path
|
Testing #includedir of a double-quoted path
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
testsudoers: test2.inc should be owned by uid 1
|
testsudoers: test2.inc should be owned by uid 1
|
||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
testsudoers: test5.inc is world writable
|
testsudoers: test5.inc is world writable
|
||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
Command unmatched
|
Command unmatched
|
||||||
testsudoers: test5.inc should be owned by gid 4294967294
|
testsudoers: test5.inc should be owned by gid 4294967294
|
||||||
Parse error in sudoers near line 1.
|
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
Testing @include without a newline
|
Testing @include without a newline
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ Command allowed
|
|||||||
|
|
||||||
Testing #include without a newline
|
Testing #include without a newline
|
||||||
|
|
||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Parses OK.
|
Parses OK
|
||||||
|
|
||||||
Entries for user root:
|
Entries for user root:
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
Error: stdin:1 cycle in User_Alias "FOO"
|
Error: stdin:1: cycle in User_Alias "FOO"
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
Warning: stdin:1 unused User_Alias "A"
|
Warning: stdin:1: unused User_Alias "A"
|
||||||
Warning: stdin:2 unused User_Alias "B"
|
Warning: stdin:2: unused User_Alias "B"
|
||||||
|
@@ -1 +1 @@
|
|||||||
visudo: stdin:1 value "2.5" is invalid for option "passwd_timeout"
|
visudo: stdin:1: value "2.5" is invalid for option "passwd_timeout"
|
||||||
|
@@ -24,7 +24,7 @@ if [ $? -eq 0 ]; then
|
|||||||
else
|
else
|
||||||
# No support for LC_NUMERIC?
|
# No support for LC_NUMERIC?
|
||||||
echo "parse error in stdin near line 1"
|
echo "parse error in stdin near line 1"
|
||||||
echo 'visudo: stdin:1 value "2.5" is invalid for option "passwd_timeout"' 1>&2
|
echo 'visudo: stdin:1: value "2.5" is invalid for option "passwd_timeout"' 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@@ -290,30 +290,23 @@ main(int argc, char *argv[])
|
|||||||
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, NULL);
|
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, NULL);
|
||||||
switch (input_format) {
|
switch (input_format) {
|
||||||
case format_ldif:
|
case format_ldif:
|
||||||
if (!sudoers_parse_ldif(&parsed_policy, stdin, NULL, true))
|
if (!sudoers_parse_ldif(&parsed_policy, stdin, NULL, true)) {
|
||||||
(void) printf("Parse error in LDIF");
|
(void) puts("Parse error in LDIF");
|
||||||
else
|
parse_error = true;
|
||||||
(void) fputs("Parses OK", stdout);
|
}
|
||||||
break;
|
break;
|
||||||
case format_sudoers:
|
case format_sudoers:
|
||||||
if (sudoersparse() != 0 || parse_error) {
|
if (sudoersparse() != 0 || parse_error)
|
||||||
parse_error = true;
|
parse_error = true;
|
||||||
if (errorlineno != -1)
|
|
||||||
(void) printf("Parse error in %s near line %d",
|
|
||||||
errorfile, errorlineno);
|
|
||||||
else
|
|
||||||
(void) printf("Parse error in %s", errorfile);
|
|
||||||
} else {
|
|
||||||
(void) fputs("Parses OK", stdout);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sudo_fatalx("error: unhandled input %d", input_format);
|
sudo_fatalx("error: unhandled input %d", input_format);
|
||||||
}
|
}
|
||||||
|
if (!parse_error)
|
||||||
|
(void) puts("Parses OK");
|
||||||
|
|
||||||
if (!update_defaults(&parsed_policy, NULL, SETDEF_ALL, false))
|
if (!update_defaults(&parsed_policy, NULL, SETDEF_ALL, false))
|
||||||
(void) fputs(" (problem with defaults entries)", stdout);
|
(void) puts("Problem with defaults entries");
|
||||||
puts(".");
|
|
||||||
|
|
||||||
if (dflag) {
|
if (dflag) {
|
||||||
(void) putchar('\n');
|
(void) putchar('\n');
|
||||||
|
@@ -2632,7 +2632,8 @@ YY_RULE_SETUP
|
|||||||
BEGIN prev_state;
|
BEGIN prev_state;
|
||||||
|
|
||||||
if (sudoerslval.string == NULL) {
|
if (sudoerslval.string == NULL) {
|
||||||
LEXTRACE("ERROR "); /* empty string */
|
sudoerserror("empty string");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
if (prev_state == INITIAL || prev_state == GOTDEFS) {
|
if (prev_state == INITIAL || prev_state == GOTDEFS) {
|
||||||
@@ -2641,14 +2642,16 @@ YY_RULE_SETUP
|
|||||||
if (sudoerslval.string[1] == '\0' ||
|
if (sudoerslval.string[1] == '\0' ||
|
||||||
(sudoerslval.string[1] == ':' &&
|
(sudoerslval.string[1] == ':' &&
|
||||||
sudoerslval.string[2] == '\0')) {
|
sudoerslval.string[2] == '\0')) {
|
||||||
LEXTRACE("ERROR "); /* empty group */
|
sudoerserror("empty group");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
LEXTRACE("USERGROUP ");
|
LEXTRACE("USERGROUP ");
|
||||||
LEXRETURN(USERGROUP);
|
LEXRETURN(USERGROUP);
|
||||||
case '+':
|
case '+':
|
||||||
if (sudoerslval.string[1] == '\0') {
|
if (sudoerslval.string[1] == '\0') {
|
||||||
LEXTRACE("ERROR "); /* empty netgroup */
|
sudoerserror("empty netgroup");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
LEXTRACE("NETGROUP ");
|
LEXTRACE("NETGROUP ");
|
||||||
@@ -2661,7 +2664,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 12:
|
case 12:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 211 "toke.l"
|
#line 214 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("BACKSLASH ");
|
LEXTRACE("BACKSLASH ");
|
||||||
if (!append(sudoerstext, sudoersleng))
|
if (!append(sudoerstext, sudoersleng))
|
||||||
@@ -2670,7 +2673,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 13:
|
case 13:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 217 "toke.l"
|
#line 220 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("STRBODY ");
|
LEXTRACE("STRBODY ");
|
||||||
if (!append(sudoerstext, sudoersleng))
|
if (!append(sudoerstext, sudoersleng))
|
||||||
@@ -2681,7 +2684,7 @@ YY_RULE_SETUP
|
|||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 225 "toke.l"
|
#line 228 "toke.l"
|
||||||
{
|
{
|
||||||
/* quoted fnmatch glob char, pass verbatim */
|
/* quoted fnmatch glob char, pass verbatim */
|
||||||
LEXTRACE("QUOTEDCHAR ");
|
LEXTRACE("QUOTEDCHAR ");
|
||||||
@@ -2692,7 +2695,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 15:
|
case 15:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 233 "toke.l"
|
#line 236 "toke.l"
|
||||||
{
|
{
|
||||||
/* quoted sudoers special char, strip backslash */
|
/* quoted sudoers special char, strip backslash */
|
||||||
LEXTRACE("QUOTEDCHAR ");
|
LEXTRACE("QUOTEDCHAR ");
|
||||||
@@ -2704,7 +2707,7 @@ YY_RULE_SETUP
|
|||||||
case 16:
|
case 16:
|
||||||
/* rule 16 can match eol */
|
/* rule 16 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 241 "toke.l"
|
#line 244 "toke.l"
|
||||||
{
|
{
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
sudoersless(0);
|
sudoersless(0);
|
||||||
@@ -2714,7 +2717,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 17:
|
case 17:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 248 "toke.l"
|
#line 251 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("ARG ");
|
LEXTRACE("ARG ");
|
||||||
if (!fill_args(sudoerstext, sudoersleng, sawspace))
|
if (!fill_args(sudoerstext, sudoersleng, sawspace))
|
||||||
@@ -2725,7 +2728,7 @@ YY_RULE_SETUP
|
|||||||
|
|
||||||
case 18:
|
case 18:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 256 "toke.l"
|
#line 259 "toke.l"
|
||||||
{
|
{
|
||||||
/* Only return DIGEST if the length is correct. */
|
/* Only return DIGEST if the length is correct. */
|
||||||
yy_size_t digest_len =
|
yy_size_t digest_len =
|
||||||
@@ -2743,7 +2746,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 19:
|
case 19:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 271 "toke.l"
|
#line 274 "toke.l"
|
||||||
{
|
{
|
||||||
/* Only return DIGEST if the length is correct. */
|
/* Only return DIGEST if the length is correct. */
|
||||||
yy_size_t len, digest_len =
|
yy_size_t len, digest_len =
|
||||||
@@ -2768,9 +2771,10 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 20:
|
case 20:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 293 "toke.l"
|
#line 296 "toke.l"
|
||||||
{
|
{
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2782,9 +2786,10 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 21:
|
case 21:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 304 "toke.l"
|
#line 308 "toke.l"
|
||||||
{
|
{
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2797,9 +2802,10 @@ YY_RULE_SETUP
|
|||||||
case 22:
|
case 22:
|
||||||
/* rule 22 can match eol */
|
/* rule 22 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 315 "toke.l"
|
#line 320 "toke.l"
|
||||||
{
|
{
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2816,9 +2822,10 @@ YY_RULE_SETUP
|
|||||||
case 23:
|
case 23:
|
||||||
/* rule 23 can match eol */
|
/* rule 23 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 330 "toke.l"
|
#line 336 "toke.l"
|
||||||
{
|
{
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2834,12 +2841,13 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 24:
|
case 24:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 345 "toke.l"
|
#line 352 "toke.l"
|
||||||
{
|
{
|
||||||
char deftype;
|
char deftype;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2854,14 +2862,10 @@ YY_RULE_SETUP
|
|||||||
BEGIN GOTDEFS;
|
BEGIN GOTDEFS;
|
||||||
switch (deftype) {
|
switch (deftype) {
|
||||||
case ':':
|
case ':':
|
||||||
sudolinebuf.toke_end =
|
|
||||||
sudolinebuf.toke_start + n;
|
|
||||||
sudoersless(n);
|
sudoersless(n);
|
||||||
LEXTRACE("DEFAULTS_USER ");
|
LEXTRACE("DEFAULTS_USER ");
|
||||||
LEXRETURN(DEFAULTS_USER);
|
LEXRETURN(DEFAULTS_USER);
|
||||||
case '>':
|
case '>':
|
||||||
sudolinebuf.toke_end =
|
|
||||||
sudolinebuf.toke_start + n;
|
|
||||||
sudoersless(n);
|
sudoersless(n);
|
||||||
LEXTRACE("DEFAULTS_RUNAS ");
|
LEXTRACE("DEFAULTS_RUNAS ");
|
||||||
LEXRETURN(DEFAULTS_RUNAS);
|
LEXRETURN(DEFAULTS_RUNAS);
|
||||||
@@ -2881,11 +2885,12 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 25:
|
case 25:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 389 "toke.l"
|
#line 393 "toke.l"
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -2910,7 +2915,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 26:
|
case 26:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 415 "toke.l"
|
#line 420 "toke.l"
|
||||||
{
|
{
|
||||||
/* cmnd does not require passwd for this user */
|
/* cmnd does not require passwd for this user */
|
||||||
LEXTRACE("NOPASSWD ");
|
LEXTRACE("NOPASSWD ");
|
||||||
@@ -2919,7 +2924,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 27:
|
case 27:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 421 "toke.l"
|
#line 426 "toke.l"
|
||||||
{
|
{
|
||||||
/* cmnd requires passwd for this user */
|
/* cmnd requires passwd for this user */
|
||||||
LEXTRACE("PASSWD ");
|
LEXTRACE("PASSWD ");
|
||||||
@@ -2928,7 +2933,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 28:
|
case 28:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 427 "toke.l"
|
#line 432 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOEXEC ");
|
LEXTRACE("NOEXEC ");
|
||||||
LEXRETURN(NOEXEC);
|
LEXRETURN(NOEXEC);
|
||||||
@@ -2936,7 +2941,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 29:
|
case 29:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 432 "toke.l"
|
#line 437 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("EXEC ");
|
LEXTRACE("EXEC ");
|
||||||
LEXRETURN(EXEC);
|
LEXRETURN(EXEC);
|
||||||
@@ -2944,7 +2949,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 30:
|
case 30:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 437 "toke.l"
|
#line 442 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("SETENV ");
|
LEXTRACE("SETENV ");
|
||||||
LEXRETURN(SETENV);
|
LEXRETURN(SETENV);
|
||||||
@@ -2952,7 +2957,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 31:
|
case 31:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 442 "toke.l"
|
#line 447 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOSETENV ");
|
LEXTRACE("NOSETENV ");
|
||||||
LEXRETURN(NOSETENV);
|
LEXRETURN(NOSETENV);
|
||||||
@@ -2960,7 +2965,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 32:
|
case 32:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 447 "toke.l"
|
#line 452 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("LOG_OUTPUT ");
|
LEXTRACE("LOG_OUTPUT ");
|
||||||
LEXRETURN(LOG_OUTPUT);
|
LEXRETURN(LOG_OUTPUT);
|
||||||
@@ -2968,7 +2973,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 33:
|
case 33:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 452 "toke.l"
|
#line 457 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOLOG_OUTPUT ");
|
LEXTRACE("NOLOG_OUTPUT ");
|
||||||
LEXRETURN(NOLOG_OUTPUT);
|
LEXRETURN(NOLOG_OUTPUT);
|
||||||
@@ -2976,7 +2981,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 34:
|
case 34:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 457 "toke.l"
|
#line 462 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("LOG_INPUT ");
|
LEXTRACE("LOG_INPUT ");
|
||||||
LEXRETURN(LOG_INPUT);
|
LEXRETURN(LOG_INPUT);
|
||||||
@@ -2984,7 +2989,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 35:
|
case 35:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 462 "toke.l"
|
#line 467 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOLOG_INPUT ");
|
LEXTRACE("NOLOG_INPUT ");
|
||||||
LEXRETURN(NOLOG_INPUT);
|
LEXRETURN(NOLOG_INPUT);
|
||||||
@@ -2992,7 +2997,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 36:
|
case 36:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 467 "toke.l"
|
#line 472 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("MAIL ");
|
LEXTRACE("MAIL ");
|
||||||
LEXRETURN(MAIL);
|
LEXRETURN(MAIL);
|
||||||
@@ -3000,7 +3005,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 37:
|
case 37:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 472 "toke.l"
|
#line 477 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOMAIL ");
|
LEXTRACE("NOMAIL ");
|
||||||
LEXRETURN(NOMAIL);
|
LEXRETURN(NOMAIL);
|
||||||
@@ -3008,7 +3013,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 38:
|
case 38:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 477 "toke.l"
|
#line 482 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("FOLLOW ");
|
LEXTRACE("FOLLOW ");
|
||||||
LEXRETURN(FOLLOWLNK);
|
LEXRETURN(FOLLOWLNK);
|
||||||
@@ -3016,7 +3021,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 39:
|
case 39:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 482 "toke.l"
|
#line 487 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOFOLLOW ");
|
LEXTRACE("NOFOLLOW ");
|
||||||
LEXRETURN(NOFOLLOWLNK);
|
LEXRETURN(NOFOLLOWLNK);
|
||||||
@@ -3024,16 +3029,19 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 40:
|
case 40:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 487 "toke.l"
|
#line 492 "toke.l"
|
||||||
{
|
{
|
||||||
/* empty group or netgroup */
|
if (sudoerstext[0] == '+')
|
||||||
|
sudoerserror("empty netgroup");
|
||||||
|
else
|
||||||
|
sudoerserror("empty group");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 41:
|
case 41:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 493 "toke.l"
|
#line 501 "toke.l"
|
||||||
{
|
{
|
||||||
/* netgroup */
|
/* netgroup */
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
@@ -3044,7 +3052,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 42:
|
case 42:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 501 "toke.l"
|
#line 509 "toke.l"
|
||||||
{
|
{
|
||||||
/* group */
|
/* group */
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
@@ -3055,7 +3063,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 43:
|
case 43:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 509 "toke.l"
|
#line 517 "toke.l"
|
||||||
{
|
{
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
yyterminate();
|
yyterminate();
|
||||||
@@ -3065,7 +3073,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 44:
|
case 44:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 516 "toke.l"
|
#line 524 "toke.l"
|
||||||
{
|
{
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
yyterminate();
|
yyterminate();
|
||||||
@@ -3075,9 +3083,10 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 45:
|
case 45:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 523 "toke.l"
|
#line 531 "toke.l"
|
||||||
{
|
{
|
||||||
if (!ipv6_valid(sudoerstext)) {
|
if (!ipv6_valid(sudoerstext)) {
|
||||||
|
sudoerserror("invalid IPv6 address");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -3089,9 +3098,10 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 46:
|
case 46:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 534 "toke.l"
|
#line 543 "toke.l"
|
||||||
{
|
{
|
||||||
if (!ipv6_valid(sudoerstext)) {
|
if (!ipv6_valid(sudoerstext)) {
|
||||||
|
sudoerserror("invalid IPv6 address");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -3103,7 +3113,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 47:
|
case 47:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 545 "toke.l"
|
#line 555 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("ALL ");
|
LEXTRACE("ALL ");
|
||||||
LEXRETURN(ALL);
|
LEXRETURN(ALL);
|
||||||
@@ -3112,7 +3122,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 48:
|
case 48:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 551 "toke.l"
|
#line 561 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("CMND_TIMEOUT ");
|
LEXTRACE("CMND_TIMEOUT ");
|
||||||
LEXRETURN(CMND_TIMEOUT);
|
LEXRETURN(CMND_TIMEOUT);
|
||||||
@@ -3120,7 +3130,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 49:
|
case 49:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 556 "toke.l"
|
#line 566 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOTBEFORE ");
|
LEXTRACE("NOTBEFORE ");
|
||||||
LEXRETURN(NOTBEFORE);
|
LEXRETURN(NOTBEFORE);
|
||||||
@@ -3128,7 +3138,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 50:
|
case 50:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 561 "toke.l"
|
#line 571 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("NOTAFTER ");
|
LEXTRACE("NOTAFTER ");
|
||||||
LEXRETURN(NOTAFTER);
|
LEXRETURN(NOTAFTER);
|
||||||
@@ -3136,7 +3146,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 51:
|
case 51:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 566 "toke.l"
|
#line 576 "toke.l"
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
LEXTRACE("ROLE ");
|
LEXTRACE("ROLE ");
|
||||||
@@ -3148,7 +3158,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 52:
|
case 52:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 575 "toke.l"
|
#line 585 "toke.l"
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
LEXTRACE("TYPE ");
|
LEXTRACE("TYPE ");
|
||||||
@@ -3160,7 +3170,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 53:
|
case 53:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 583 "toke.l"
|
#line 593 "toke.l"
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PRIV_SET
|
#ifdef HAVE_PRIV_SET
|
||||||
LEXTRACE("PRIVS ");
|
LEXTRACE("PRIVS ");
|
||||||
@@ -3172,7 +3182,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 54:
|
case 54:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 592 "toke.l"
|
#line 602 "toke.l"
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PRIV_SET
|
#ifdef HAVE_PRIV_SET
|
||||||
LEXTRACE("LIMITPRIVS ");
|
LEXTRACE("LIMITPRIVS ");
|
||||||
@@ -3184,7 +3194,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 55:
|
case 55:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 601 "toke.l"
|
#line 611 "toke.l"
|
||||||
{
|
{
|
||||||
got_alias:
|
got_alias:
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
@@ -3195,7 +3205,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 56:
|
case 56:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 609 "toke.l"
|
#line 619 "toke.l"
|
||||||
{
|
{
|
||||||
/* XXX - no way to specify digest for command */
|
/* XXX - no way to specify digest for command */
|
||||||
/* no command args allowed for Defaults!/path */
|
/* no command args allowed for Defaults!/path */
|
||||||
@@ -3207,7 +3217,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 57:
|
case 57:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 618 "toke.l"
|
#line 628 "toke.l"
|
||||||
{
|
{
|
||||||
digest_type = SUDO_DIGEST_SHA224;
|
digest_type = SUDO_DIGEST_SHA224;
|
||||||
BEGIN WANTDIGEST;
|
BEGIN WANTDIGEST;
|
||||||
@@ -3217,7 +3227,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 58:
|
case 58:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 625 "toke.l"
|
#line 635 "toke.l"
|
||||||
{
|
{
|
||||||
digest_type = SUDO_DIGEST_SHA256;
|
digest_type = SUDO_DIGEST_SHA256;
|
||||||
BEGIN WANTDIGEST;
|
BEGIN WANTDIGEST;
|
||||||
@@ -3227,7 +3237,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 59:
|
case 59:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 632 "toke.l"
|
#line 642 "toke.l"
|
||||||
{
|
{
|
||||||
digest_type = SUDO_DIGEST_SHA384;
|
digest_type = SUDO_DIGEST_SHA384;
|
||||||
BEGIN WANTDIGEST;
|
BEGIN WANTDIGEST;
|
||||||
@@ -3237,7 +3247,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 60:
|
case 60:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 639 "toke.l"
|
#line 649 "toke.l"
|
||||||
{
|
{
|
||||||
digest_type = SUDO_DIGEST_SHA512;
|
digest_type = SUDO_DIGEST_SHA512;
|
||||||
BEGIN WANTDIGEST;
|
BEGIN WANTDIGEST;
|
||||||
@@ -3247,7 +3257,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 61:
|
case 61:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 646 "toke.l"
|
#line 656 "toke.l"
|
||||||
{
|
{
|
||||||
BEGIN GOTCMND;
|
BEGIN GOTCMND;
|
||||||
LEXTRACE("COMMAND ");
|
LEXTRACE("COMMAND ");
|
||||||
@@ -3257,7 +3267,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 62:
|
case 62:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 653 "toke.l"
|
#line 663 "toke.l"
|
||||||
{
|
{
|
||||||
/* directories can't have args... */
|
/* directories can't have args... */
|
||||||
if (sudoerstext[sudoersleng - 1] == '/') {
|
if (sudoerstext[sudoersleng - 1] == '/') {
|
||||||
@@ -3275,7 +3285,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 63:
|
case 63:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 668 "toke.l"
|
#line 678 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("BEGINSTR ");
|
LEXTRACE("BEGINSTR ");
|
||||||
sudoerslval.string = NULL;
|
sudoerslval.string = NULL;
|
||||||
@@ -3285,7 +3295,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 64:
|
case 64:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 675 "toke.l"
|
#line 685 "toke.l"
|
||||||
{
|
{
|
||||||
/* a word */
|
/* a word */
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
@@ -3297,7 +3307,7 @@ YY_RULE_SETUP
|
|||||||
|
|
||||||
case 65:
|
case 65:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 684 "toke.l"
|
#line 694 "toke.l"
|
||||||
{
|
{
|
||||||
/* include file/directory */
|
/* include file/directory */
|
||||||
if (!fill(sudoerstext, sudoersleng))
|
if (!fill(sudoerstext, sudoersleng))
|
||||||
@@ -3309,7 +3319,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 66:
|
case 66:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 693 "toke.l"
|
#line 703 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("BEGINSTR ");
|
LEXTRACE("BEGINSTR ");
|
||||||
sudoerslval.string = NULL;
|
sudoerslval.string = NULL;
|
||||||
@@ -3320,7 +3330,7 @@ YY_RULE_SETUP
|
|||||||
|
|
||||||
case 67:
|
case 67:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 701 "toke.l"
|
#line 711 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("( ");
|
LEXTRACE("( ");
|
||||||
LEXRETURN('(');
|
LEXRETURN('(');
|
||||||
@@ -3328,7 +3338,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 68:
|
case 68:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 706 "toke.l"
|
#line 716 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE(") ");
|
LEXTRACE(") ");
|
||||||
LEXRETURN(')');
|
LEXRETURN(')');
|
||||||
@@ -3336,7 +3346,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 69:
|
case 69:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 711 "toke.l"
|
#line 721 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE(", ");
|
LEXTRACE(", ");
|
||||||
LEXRETURN(',');
|
LEXRETURN(',');
|
||||||
@@ -3344,7 +3354,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 70:
|
case 70:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 716 "toke.l"
|
#line 726 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("= ");
|
LEXTRACE("= ");
|
||||||
LEXRETURN('=');
|
LEXRETURN('=');
|
||||||
@@ -3352,7 +3362,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 71:
|
case 71:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 721 "toke.l"
|
#line 731 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE(": ");
|
LEXTRACE(": ");
|
||||||
LEXRETURN(':');
|
LEXRETURN(':');
|
||||||
@@ -3360,7 +3370,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 72:
|
case 72:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 726 "toke.l"
|
#line 736 "toke.l"
|
||||||
{
|
{
|
||||||
if (sudoersleng & 1) {
|
if (sudoersleng & 1) {
|
||||||
LEXTRACE("!");
|
LEXTRACE("!");
|
||||||
@@ -3371,12 +3381,12 @@ YY_RULE_SETUP
|
|||||||
case 73:
|
case 73:
|
||||||
/* rule 73 can match eol */
|
/* rule 73 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 733 "toke.l"
|
#line 743 "toke.l"
|
||||||
{
|
{
|
||||||
if (YY_START == INSTR) {
|
if (YY_START == INSTR) {
|
||||||
/* XXX - better error message */
|
sudoerserror("unexpected line break in string");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR); /* line break in string */
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
sudolineno++;
|
sudolineno++;
|
||||||
@@ -3387,7 +3397,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 74:
|
case 74:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 746 "toke.l"
|
#line 756 "toke.l"
|
||||||
{ /* throw away space/tabs */
|
{ /* throw away space/tabs */
|
||||||
sawspace = true; /* but remember for fill_args */
|
sawspace = true; /* but remember for fill_args */
|
||||||
}
|
}
|
||||||
@@ -3395,7 +3405,7 @@ YY_RULE_SETUP
|
|||||||
case 75:
|
case 75:
|
||||||
/* rule 75 can match eol */
|
/* rule 75 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 750 "toke.l"
|
#line 760 "toke.l"
|
||||||
{
|
{
|
||||||
sawspace = true; /* remember for fill_args */
|
sawspace = true; /* remember for fill_args */
|
||||||
sudolineno++;
|
sudolineno++;
|
||||||
@@ -3405,7 +3415,7 @@ YY_RULE_SETUP
|
|||||||
case 76:
|
case 76:
|
||||||
/* rule 76 can match eol */
|
/* rule 76 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 756 "toke.l"
|
#line 766 "toke.l"
|
||||||
{
|
{
|
||||||
if (sudoerstext[sudoersleng - 1] == '\n') {
|
if (sudoerstext[sudoersleng - 1] == '\n') {
|
||||||
/* comment ending in a newline */
|
/* comment ending in a newline */
|
||||||
@@ -3413,6 +3423,7 @@ YY_RULE_SETUP
|
|||||||
sudolineno++;
|
sudolineno++;
|
||||||
continued = false;
|
continued = false;
|
||||||
} else if (!feof(sudoersin)) {
|
} else if (!feof(sudoersin)) {
|
||||||
|
sudoerserror(strerror(errno));
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -3422,7 +3433,7 @@ YY_RULE_SETUP
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 77:
|
case 77:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 770 "toke.l"
|
#line 781 "toke.l"
|
||||||
{
|
{
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
@@ -3436,7 +3447,7 @@ case YY_STATE_EOF(INDEFS):
|
|||||||
case YY_STATE_EOF(INSTR):
|
case YY_STATE_EOF(INSTR):
|
||||||
case YY_STATE_EOF(WANTDIGEST):
|
case YY_STATE_EOF(WANTDIGEST):
|
||||||
case YY_STATE_EOF(GOTINC):
|
case YY_STATE_EOF(GOTINC):
|
||||||
#line 775 "toke.l"
|
#line 786 "toke.l"
|
||||||
{
|
{
|
||||||
if (YY_START != INITIAL) {
|
if (YY_START != INITIAL) {
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
@@ -3449,10 +3460,10 @@ case YY_STATE_EOF(GOTINC):
|
|||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 78:
|
case 78:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 785 "toke.l"
|
#line 796 "toke.l"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 3450 "toke.c"
|
#line 3461 "toke.c"
|
||||||
|
|
||||||
case YY_END_OF_BUFFER:
|
case YY_END_OF_BUFFER:
|
||||||
{
|
{
|
||||||
@@ -4413,7 +4424,7 @@ void sudoersfree (void * ptr )
|
|||||||
|
|
||||||
#define YYTABLES_NAME "yytables"
|
#define YYTABLES_NAME "yytables"
|
||||||
|
|
||||||
#line 785 "toke.l"
|
#line 796 "toke.l"
|
||||||
|
|
||||||
|
|
||||||
struct path_list {
|
struct path_list {
|
||||||
@@ -4800,8 +4811,8 @@ pop_include(void)
|
|||||||
SLIST_REMOVE_HEAD(&istack[idepth - 1].more, entries);
|
SLIST_REMOVE_HEAD(&istack[idepth - 1].more, entries);
|
||||||
fp = open_sudoers(pl->path, false, &keepopen);
|
fp = open_sudoers(pl->path, false, &keepopen);
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
|
||||||
sudolinebuf.len = sudolinebuf.off = 0;
|
sudolinebuf.len = sudolinebuf.off = 0;
|
||||||
|
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
||||||
rcstr_delref(sudoers);
|
rcstr_delref(sudoers);
|
||||||
sudoers = pl->path;
|
sudoers = pl->path;
|
||||||
sudolineno = 1;
|
sudolineno = 1;
|
||||||
@@ -4850,7 +4861,7 @@ sudoers_trace_print(const char *msg)
|
|||||||
if (strchr(msg, '\n') != NULL)
|
if (strchr(msg, '\n') != NULL)
|
||||||
{
|
{
|
||||||
sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG,
|
sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG,
|
||||||
"%s:%d %s", sudoers, sudolineno, lbuf.buf);
|
"%s:%d: %s", sudoers, sudolineno, lbuf.buf);
|
||||||
lbuf.len = 0;
|
lbuf.len = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4864,17 +4875,16 @@ sudoers_input(char *buf, yy_size_t max_size)
|
|||||||
|
|
||||||
/* Refill line buffer if needed. */
|
/* Refill line buffer if needed. */
|
||||||
if (avail == 0) {
|
if (avail == 0) {
|
||||||
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
avail = getdelim(&sudolinebuf.buf, &sudolinebuf.size, '\n', sudoersin);
|
||||||
sudolinebuf.off = 0;
|
if (avail == (size_t)-1) {
|
||||||
sudolinebuf.len = getdelim(&sudolinebuf.buf, &sudolinebuf.size,
|
/* EOF or error. */
|
||||||
'\n', sudoersin);
|
|
||||||
if (sudolinebuf.len == (size_t)-1) {
|
|
||||||
if (ferror(sudoersin) && errno != EINTR)
|
if (ferror(sudoersin) && errno != EINTR)
|
||||||
YY_FATAL_ERROR("input in flex scanner failed");
|
YY_FATAL_ERROR("input in flex scanner failed");
|
||||||
sudolinebuf.len = 0;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
avail = sudolinebuf.len;
|
sudolinebuf.len = avail;
|
||||||
|
sudolinebuf.off = 0;
|
||||||
|
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avail > max_size)
|
if (avail > max_size)
|
||||||
|
@@ -181,7 +181,8 @@ DEFVAR [a-z_]+
|
|||||||
BEGIN prev_state;
|
BEGIN prev_state;
|
||||||
|
|
||||||
if (sudoerslval.string == NULL) {
|
if (sudoerslval.string == NULL) {
|
||||||
LEXTRACE("ERROR "); /* empty string */
|
sudoerserror("empty string");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
if (prev_state == INITIAL || prev_state == GOTDEFS) {
|
if (prev_state == INITIAL || prev_state == GOTDEFS) {
|
||||||
@@ -190,14 +191,16 @@ DEFVAR [a-z_]+
|
|||||||
if (sudoerslval.string[1] == '\0' ||
|
if (sudoerslval.string[1] == '\0' ||
|
||||||
(sudoerslval.string[1] == ':' &&
|
(sudoerslval.string[1] == ':' &&
|
||||||
sudoerslval.string[2] == '\0')) {
|
sudoerslval.string[2] == '\0')) {
|
||||||
LEXTRACE("ERROR "); /* empty group */
|
sudoerserror("empty group");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
LEXTRACE("USERGROUP ");
|
LEXTRACE("USERGROUP ");
|
||||||
LEXRETURN(USERGROUP);
|
LEXRETURN(USERGROUP);
|
||||||
case '+':
|
case '+':
|
||||||
if (sudoerslval.string[1] == '\0') {
|
if (sudoerslval.string[1] == '\0') {
|
||||||
LEXTRACE("ERROR "); /* empty netgroup */
|
sudoerserror("empty netgroup");
|
||||||
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
LEXTRACE("NETGROUP ");
|
LEXTRACE("NETGROUP ");
|
||||||
@@ -292,6 +295,7 @@ DEFVAR [a-z_]+
|
|||||||
|
|
||||||
<INITIAL>@include {
|
<INITIAL>@include {
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -303,6 +307,7 @@ DEFVAR [a-z_]+
|
|||||||
|
|
||||||
<INITIAL>@includedir {
|
<INITIAL>@includedir {
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -314,6 +319,7 @@ DEFVAR [a-z_]+
|
|||||||
|
|
||||||
<INITIAL>^#include[[:blank:]]+.*(\r\n|\n)? {
|
<INITIAL>^#include[[:blank:]]+.*(\r\n|\n)? {
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -329,6 +335,7 @@ DEFVAR [a-z_]+
|
|||||||
|
|
||||||
<INITIAL>^#includedir[[:blank:]]+.*(\r\n|\n)? {
|
<INITIAL>^#includedir[[:blank:]]+.*(\r\n|\n)? {
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -347,6 +354,7 @@ DEFVAR [a-z_]+
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -361,14 +369,10 @@ DEFVAR [a-z_]+
|
|||||||
BEGIN GOTDEFS;
|
BEGIN GOTDEFS;
|
||||||
switch (deftype) {
|
switch (deftype) {
|
||||||
case ':':
|
case ':':
|
||||||
sudolinebuf.toke_end =
|
|
||||||
sudolinebuf.toke_start + n;
|
|
||||||
sudoersless(n);
|
sudoersless(n);
|
||||||
LEXTRACE("DEFAULTS_USER ");
|
LEXTRACE("DEFAULTS_USER ");
|
||||||
LEXRETURN(DEFAULTS_USER);
|
LEXRETURN(DEFAULTS_USER);
|
||||||
case '>':
|
case '>':
|
||||||
sudolinebuf.toke_end =
|
|
||||||
sudolinebuf.toke_start + n;
|
|
||||||
sudoersless(n);
|
sudoersless(n);
|
||||||
LEXTRACE("DEFAULTS_RUNAS ");
|
LEXTRACE("DEFAULTS_RUNAS ");
|
||||||
LEXRETURN(DEFAULTS_RUNAS);
|
LEXRETURN(DEFAULTS_RUNAS);
|
||||||
@@ -390,6 +394,7 @@ DEFVAR [a-z_]+
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (continued) {
|
if (continued) {
|
||||||
|
sudoerserror("invalid line continuation");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -485,7 +490,10 @@ NOFOLLOW[[:blank:]]*: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL,GOTDEFS>(\+|\%|\%:) {
|
<INITIAL,GOTDEFS>(\+|\%|\%:) {
|
||||||
/* empty group or netgroup */
|
if (sudoerstext[0] == '+')
|
||||||
|
sudoerserror("empty netgroup");
|
||||||
|
else
|
||||||
|
sudoerserror("empty group");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -522,6 +530,7 @@ NOFOLLOW[[:blank:]]*: {
|
|||||||
|
|
||||||
{IPV6ADDR}(\/{IPV6ADDR})? {
|
{IPV6ADDR}(\/{IPV6ADDR})? {
|
||||||
if (!ipv6_valid(sudoerstext)) {
|
if (!ipv6_valid(sudoerstext)) {
|
||||||
|
sudoerserror("invalid IPv6 address");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -533,6 +542,7 @@ NOFOLLOW[[:blank:]]*: {
|
|||||||
|
|
||||||
{IPV6ADDR}\/([0-9]|[1-9][0-9]|1[01][0-9]|12[0-8]) {
|
{IPV6ADDR}\/([0-9]|[1-9][0-9]|1[01][0-9]|12[0-8]) {
|
||||||
if (!ipv6_valid(sudoerstext)) {
|
if (!ipv6_valid(sudoerstext)) {
|
||||||
|
sudoerserror("invalid IPv6 address");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -732,9 +742,9 @@ sudoedit {
|
|||||||
|
|
||||||
<*>\r?\n {
|
<*>\r?\n {
|
||||||
if (YY_START == INSTR) {
|
if (YY_START == INSTR) {
|
||||||
/* XXX - better error message */
|
sudoerserror("unexpected line break in string");
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR); /* line break in string */
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
sudolineno++;
|
sudolineno++;
|
||||||
@@ -760,6 +770,7 @@ sudoedit {
|
|||||||
sudolineno++;
|
sudolineno++;
|
||||||
continued = false;
|
continued = false;
|
||||||
} else if (!feof(sudoersin)) {
|
} else if (!feof(sudoersin)) {
|
||||||
|
sudoerserror(strerror(errno));
|
||||||
LEXTRACE("ERROR ");
|
LEXTRACE("ERROR ");
|
||||||
LEXRETURN(ERROR);
|
LEXRETURN(ERROR);
|
||||||
}
|
}
|
||||||
@@ -1167,8 +1178,8 @@ pop_include(void)
|
|||||||
SLIST_REMOVE_HEAD(&istack[idepth - 1].more, entries);
|
SLIST_REMOVE_HEAD(&istack[idepth - 1].more, entries);
|
||||||
fp = open_sudoers(pl->path, false, &keepopen);
|
fp = open_sudoers(pl->path, false, &keepopen);
|
||||||
if (fp != NULL) {
|
if (fp != NULL) {
|
||||||
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
|
||||||
sudolinebuf.len = sudolinebuf.off = 0;
|
sudolinebuf.len = sudolinebuf.off = 0;
|
||||||
|
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
||||||
rcstr_delref(sudoers);
|
rcstr_delref(sudoers);
|
||||||
sudoers = pl->path;
|
sudoers = pl->path;
|
||||||
sudolineno = 1;
|
sudolineno = 1;
|
||||||
@@ -1217,7 +1228,7 @@ sudoers_trace_print(const char *msg)
|
|||||||
if (strchr(msg, '\n') != NULL)
|
if (strchr(msg, '\n') != NULL)
|
||||||
{
|
{
|
||||||
sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG,
|
sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG,
|
||||||
"%s:%d %s", sudoers, sudolineno, lbuf.buf);
|
"%s:%d: %s", sudoers, sudolineno, lbuf.buf);
|
||||||
lbuf.len = 0;
|
lbuf.len = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1231,17 +1242,16 @@ sudoers_input(char *buf, yy_size_t max_size)
|
|||||||
|
|
||||||
/* Refill line buffer if needed. */
|
/* Refill line buffer if needed. */
|
||||||
if (avail == 0) {
|
if (avail == 0) {
|
||||||
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
avail = getdelim(&sudolinebuf.buf, &sudolinebuf.size, '\n', sudoersin);
|
||||||
sudolinebuf.off = 0;
|
if (avail == (size_t)-1) {
|
||||||
sudolinebuf.len = getdelim(&sudolinebuf.buf, &sudolinebuf.size,
|
/* EOF or error. */
|
||||||
'\n', sudoersin);
|
|
||||||
if (sudolinebuf.len == (size_t)-1) {
|
|
||||||
if (ferror(sudoersin) && errno != EINTR)
|
if (ferror(sudoersin) && errno != EINTR)
|
||||||
YY_FATAL_ERROR("input in flex scanner failed");
|
YY_FATAL_ERROR("input in flex scanner failed");
|
||||||
sudolinebuf.len = 0;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
avail = sudolinebuf.len;
|
sudolinebuf.len = avail;
|
||||||
|
sudolinebuf.off = 0;
|
||||||
|
sudolinebuf.toke_start = sudolinebuf.toke_end = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avail > max_size)
|
if (avail > max_size)
|
||||||
|
@@ -1080,13 +1080,13 @@ check_alias(char *name, int type, char *file, int lineno, bool strict, bool quie
|
|||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
if (errno == ELOOP) {
|
if (errno == ELOOP) {
|
||||||
fprintf(stderr, strict ?
|
fprintf(stderr, strict ?
|
||||||
U_("Error: %s:%d cycle in %s \"%s\"") :
|
U_("Error: %s:%d: cycle in %s \"%s\"") :
|
||||||
U_("Warning: %s:%d cycle in %s \"%s\""),
|
U_("Warning: %s:%d: cycle in %s \"%s\""),
|
||||||
file, lineno, alias_type_to_string(type), name);
|
file, lineno, alias_type_to_string(type), name);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, strict ?
|
fprintf(stderr, strict ?
|
||||||
U_("Error: %s:%d %s \"%s\" referenced but not defined") :
|
U_("Error: %s:%d: %s \"%s\" referenced but not defined") :
|
||||||
U_("Warning: %s:%d %s \"%s\" referenced but not defined"),
|
U_("Warning: %s:%d: %s \"%s\" referenced but not defined"),
|
||||||
file, lineno, alias_type_to_string(type), name);
|
file, lineno, alias_type_to_string(type), name);
|
||||||
}
|
}
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
@@ -1177,7 +1177,7 @@ check_aliases(bool strict, bool quiet)
|
|||||||
static int
|
static int
|
||||||
print_unused(struct sudoers_parse_tree *parse_tree, struct alias *a, void *v)
|
print_unused(struct sudoers_parse_tree *parse_tree, struct alias *a, void *v)
|
||||||
{
|
{
|
||||||
fprintf(stderr, U_("Warning: %s:%d unused %s \"%s\""),
|
fprintf(stderr, U_("Warning: %s:%d: unused %s \"%s\""),
|
||||||
a->file, a->lineno, alias_type_to_string(a->type), a->name);
|
a->file, a->lineno, alias_type_to_string(a->type), a->name);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user