mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Go back to storing the last error file/line in sudoerserrorf().
This is still the best way to avoid displaying more than one error per line.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -89,21 +89,20 @@ extern int sudoersdebug;
|
||||
USERALIAS = 290, /* USERALIAS */
|
||||
RUNASALIAS = 291, /* RUNASALIAS */
|
||||
ERROR = 292, /* ERROR */
|
||||
NOMATCH = 293, /* NOMATCH */
|
||||
CHROOT = 294, /* CHROOT */
|
||||
CWD = 295, /* CWD */
|
||||
TYPE = 296, /* TYPE */
|
||||
ROLE = 297, /* ROLE */
|
||||
PRIVS = 298, /* PRIVS */
|
||||
LIMITPRIVS = 299, /* LIMITPRIVS */
|
||||
CMND_TIMEOUT = 300, /* CMND_TIMEOUT */
|
||||
NOTBEFORE = 301, /* NOTBEFORE */
|
||||
NOTAFTER = 302, /* NOTAFTER */
|
||||
MYSELF = 303, /* MYSELF */
|
||||
SHA224_TOK = 304, /* SHA224_TOK */
|
||||
SHA256_TOK = 305, /* SHA256_TOK */
|
||||
SHA384_TOK = 306, /* SHA384_TOK */
|
||||
SHA512_TOK = 307 /* SHA512_TOK */
|
||||
CHROOT = 293, /* CHROOT */
|
||||
CWD = 294, /* CWD */
|
||||
TYPE = 295, /* TYPE */
|
||||
ROLE = 296, /* ROLE */
|
||||
PRIVS = 297, /* PRIVS */
|
||||
LIMITPRIVS = 298, /* LIMITPRIVS */
|
||||
CMND_TIMEOUT = 299, /* CMND_TIMEOUT */
|
||||
NOTBEFORE = 300, /* NOTBEFORE */
|
||||
NOTAFTER = 301, /* NOTAFTER */
|
||||
MYSELF = 302, /* MYSELF */
|
||||
SHA224_TOK = 303, /* SHA224_TOK */
|
||||
SHA256_TOK = 304, /* SHA256_TOK */
|
||||
SHA384_TOK = 305, /* SHA384_TOK */
|
||||
SHA512_TOK = 306 /* SHA512_TOK */
|
||||
};
|
||||
typedef enum yytokentype yytoken_kind_t;
|
||||
#endif
|
||||
@@ -147,21 +146,20 @@ extern int sudoersdebug;
|
||||
#define USERALIAS 290
|
||||
#define RUNASALIAS 291
|
||||
#define ERROR 292
|
||||
#define NOMATCH 293
|
||||
#define CHROOT 294
|
||||
#define CWD 295
|
||||
#define TYPE 296
|
||||
#define ROLE 297
|
||||
#define PRIVS 298
|
||||
#define LIMITPRIVS 299
|
||||
#define CMND_TIMEOUT 300
|
||||
#define NOTBEFORE 301
|
||||
#define NOTAFTER 302
|
||||
#define MYSELF 303
|
||||
#define SHA224_TOK 304
|
||||
#define SHA256_TOK 305
|
||||
#define SHA384_TOK 306
|
||||
#define SHA512_TOK 307
|
||||
#define CHROOT 293
|
||||
#define CWD 294
|
||||
#define TYPE 295
|
||||
#define ROLE 296
|
||||
#define PRIVS 297
|
||||
#define LIMITPRIVS 298
|
||||
#define CMND_TIMEOUT 299
|
||||
#define NOTBEFORE 300
|
||||
#define NOTAFTER 301
|
||||
#define MYSELF 302
|
||||
#define SHA224_TOK 303
|
||||
#define SHA256_TOK 304
|
||||
#define SHA384_TOK 305
|
||||
#define SHA512_TOK 306
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
@@ -181,7 +179,7 @@ union YYSTYPE
|
||||
char *string;
|
||||
int tok;
|
||||
|
||||
#line 185 "y.tab.h"
|
||||
#line 183 "y.tab.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
@@ -138,7 +138,6 @@ static void alias_error(const char *name, int errnum);
|
||||
%token <tok> '(' ')' /* runas tokens */
|
||||
%token <tok> '\n' /* newline (with optional comment) */
|
||||
%token <tok> ERROR /* error from lexer */
|
||||
%token <tok> NOMATCH /* no match from lexer */
|
||||
%token <tok> CHROOT /* root directory for command */
|
||||
%token <tok> CWD /* working directory for command */
|
||||
%token <tok> TYPE /* SELinux type */
|
||||
@@ -1150,11 +1149,15 @@ group : ALIAS {
|
||||
void
|
||||
sudoerserrorf(const char *fmt, ...)
|
||||
{
|
||||
static int last_error_line = -1;
|
||||
static char *last_error_file = NULL;
|
||||
debug_decl(sudoerserrorf, SUDOERS_DEBUG_PARSER);
|
||||
|
||||
/* The lexer displays more detailed messages for ERROR tokens. */
|
||||
if (sudoerschar == ERROR)
|
||||
/* Only print the first error found in a line. */
|
||||
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. */
|
||||
if (errorlineno == -1) {
|
||||
|
@@ -4025,9 +4025,9 @@ case 80:
|
||||
YY_RULE_SETUP
|
||||
#line 810 "toke.l"
|
||||
{
|
||||
LEXTRACE("NOMATCH ");
|
||||
return NOMATCH;
|
||||
} /* parse error, no matching token */
|
||||
LEXTRACE("ERROR ");
|
||||
return ERROR;
|
||||
} /* parse error */
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(GOTDEFS):
|
||||
|
@@ -808,9 +808,9 @@ sudoedit {
|
||||
} /* comment, not uid/gid */
|
||||
|
||||
<*>. {
|
||||
LEXTRACE("NOMATCH ");
|
||||
return NOMATCH;
|
||||
} /* parse error, no matching token */
|
||||
LEXTRACE("ERROR ");
|
||||
return ERROR;
|
||||
} /* parse error */
|
||||
|
||||
<*><<EOF>> {
|
||||
if (!pop_include())
|
||||
|
Reference in New Issue
Block a user