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