Rename init_parser_ext() to init_parser() and remove old wrapper.
There was only one consumer of the init_parser() wrapper now that reset_parser() has been introduced.
This commit is contained in:
@@ -770,7 +770,7 @@ parse_sudoers(const char *input_file, struct cvtsudoers_config *conf)
|
||||
input_file = "stdin";
|
||||
} else if ((sudoersin = fopen(input_file, "r")) == NULL)
|
||||
sudo_fatal(U_("unable to open %s"), input_file);
|
||||
init_parser(input_file);
|
||||
init_parser(input_file, NULL, false, 1);
|
||||
if (sudoersparse() && !parse_error) {
|
||||
sudo_warnx(U_("failed to parse %s file, unknown error"), input_file);
|
||||
parse_error = true;
|
||||
|
@@ -3965,7 +3965,7 @@ free_parse_tree(struct sudoers_parse_tree *parse_tree)
|
||||
* the current sudoers file to path.
|
||||
*/
|
||||
bool
|
||||
init_parser_ext(const char *file, const char *path, bool strict, int verbose)
|
||||
init_parser(const char *file, const char *path, bool strict, int verbose)
|
||||
{
|
||||
bool ret = true;
|
||||
debug_decl(init_parser, SUDOERS_DEBUG_PARSER);
|
||||
@@ -4001,16 +4001,10 @@ init_parser_ext(const char *file, const char *path, bool strict, int verbose)
|
||||
debug_return_bool(ret);
|
||||
}
|
||||
|
||||
bool
|
||||
init_parser(const char *file)
|
||||
{
|
||||
return init_parser_ext(file, NULL, false, 1);
|
||||
}
|
||||
|
||||
bool
|
||||
reset_parser(void)
|
||||
{
|
||||
return init_parser_ext(NULL, NULL, false, 1);
|
||||
return init_parser(NULL, NULL, false, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1782,7 +1782,7 @@ free_parse_tree(struct sudoers_parse_tree *parse_tree)
|
||||
* the current sudoers file to path.
|
||||
*/
|
||||
bool
|
||||
init_parser_ext(const char *file, const char *path, bool strict, int verbose)
|
||||
init_parser(const char *file, const char *path, bool strict, int verbose)
|
||||
{
|
||||
bool ret = true;
|
||||
debug_decl(init_parser, SUDOERS_DEBUG_PARSER);
|
||||
@@ -1818,16 +1818,10 @@ init_parser_ext(const char *file, const char *path, bool strict, int verbose)
|
||||
debug_return_bool(ret);
|
||||
}
|
||||
|
||||
bool
|
||||
init_parser(const char *file)
|
||||
{
|
||||
return init_parser_ext(file, NULL, false, 1);
|
||||
}
|
||||
|
||||
bool
|
||||
reset_parser(void)
|
||||
{
|
||||
return init_parser_ext(NULL, NULL, false, 1);
|
||||
return init_parser(NULL, NULL, false, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -372,8 +372,7 @@ int check_aliases(struct sudoers_parse_tree *parse_tree, bool strict, bool quiet
|
||||
/* gram.y */
|
||||
extern struct sudoers_parse_tree parsed_policy;
|
||||
extern bool (*sudoers_error_hook)(const char *file, int line, int column, const char *fmt, va_list args);
|
||||
bool init_parser(const char *file);
|
||||
bool init_parser_ext(const char *file, const char *path, bool strict, int verbose);
|
||||
bool init_parser(const char *file, const char *path, bool strict, int verbose);
|
||||
bool reset_parser(void);
|
||||
void free_member(struct member *m);
|
||||
void free_members(struct member_list *members);
|
||||
|
@@ -312,7 +312,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
|
||||
/* Initialize defaults and parse sudoers. */
|
||||
init_defaults();
|
||||
init_parser_ext("sudoers", NULL, true, 1);
|
||||
init_parser("sudoers", NULL, true, 1);
|
||||
sudoersrestart(fp);
|
||||
sudoersparse();
|
||||
reparent_parse_tree(&parse_tree);
|
||||
|
@@ -274,7 +274,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Initialize the parser and set sudoers filename to "sudoers". */
|
||||
init_parser_ext("sudoers", NULL, true, 2);
|
||||
init_parser("sudoers", NULL, true, 2);
|
||||
|
||||
/*
|
||||
* Set runas passwd/group entries based on command line or sudoers.
|
||||
|
@@ -288,7 +288,7 @@ main(int argc, char *argv[])
|
||||
* Parse the existing sudoers file(s) to highlight any existing
|
||||
* errors and to pull in editor and env_editor conf values.
|
||||
*/
|
||||
init_parser_ext(NULL, path_sudoers, true, quiet ? 0 : 2);
|
||||
init_parser(NULL, path_sudoers, true, quiet ? 0 : 2);
|
||||
if ((sudoersin = open_sudoers(path_sudoers, &sudoers, true, NULL)) == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
|
||||
@@ -651,7 +651,7 @@ reparse_sudoers(char *editor, int editor_argc, char **editor_argv,
|
||||
/* Clean slate for each parse */
|
||||
if (!init_defaults())
|
||||
sudo_fatalx("%s", U_("unable to initialize sudoers default values"));
|
||||
init_parser_ext(sp->opath, path_sudoers, true, quiet ? 0 : 2);
|
||||
init_parser(sp->opath, path_sudoers, true, quiet ? 0 : 2);
|
||||
sp->errorline = -1;
|
||||
|
||||
/* Parse the sudoers temp file(s) */
|
||||
@@ -1068,7 +1068,7 @@ check_syntax(const char *path, bool quiet, bool strict, bool check_owner,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
init_parser_ext(fname, path, true, quiet ? 0 : 2);
|
||||
init_parser(fname, path, true, quiet ? 0 : 2);
|
||||
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
|
||||
if (sudoersparse() && !parse_error) {
|
||||
if (!quiet)
|
||||
|
Reference in New Issue
Block a user