diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-05-02 13:29:49 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-05-02 13:29:49 -0600 |
commit | 9690ab60b9770ee0b5adcdf1cbfcb4a8970977ff (patch) | |
tree | 57f7a31e72747c6fabc005835e25a32b3e66967e | |
parent | 899add50a9ab6ad963b3f849c033326fb95866da (diff) | |
download | sudo-9690ab60b9770ee0b5adcdf1cbfcb4a8970977ff.tar.gz |
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.
-rw-r--r-- | plugins/sudoers/cvtsudoers.c | 2 | ||||
-rw-r--r-- | plugins/sudoers/gram.c | 10 | ||||
-rw-r--r-- | plugins/sudoers/gram.y | 10 | ||||
-rw-r--r-- | plugins/sudoers/parse.h | 3 | ||||
-rw-r--r-- | plugins/sudoers/regress/fuzz/fuzz_sudoers.c | 2 | ||||
-rw-r--r-- | plugins/sudoers/testsudoers.c | 2 | ||||
-rw-r--r-- | plugins/sudoers/visudo.c | 6 |
7 files changed, 11 insertions, 24 deletions
diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index f083f92cb..870049bbb 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -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; diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index f1d784839..d45c2d1ec 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -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); @@ -4002,15 +4002,9 @@ init_parser_ext(const char *file, const char *path, bool strict, int verbose) } 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); } /* diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index b72eb091c..887b01577 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -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); @@ -1819,15 +1819,9 @@ init_parser_ext(const char *file, const char *path, bool strict, int verbose) } 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); } /* diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h index 74cf0602b..9092e4d8c 100644 --- a/plugins/sudoers/parse.h +++ b/plugins/sudoers/parse.h @@ -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); diff --git a/plugins/sudoers/regress/fuzz/fuzz_sudoers.c b/plugins/sudoers/regress/fuzz/fuzz_sudoers.c index 61f913c62..0919c4d76 100644 --- a/plugins/sudoers/regress/fuzz/fuzz_sudoers.c +++ b/plugins/sudoers/regress/fuzz/fuzz_sudoers.c @@ -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); diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 673046183..4e7275398 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -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. diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index db7d50ec3..7e97ab61b 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -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) |