sudo_file_open: initialize parser before calling open_sudoers().

Otherwise, the parser_conf settings in the context passed to
sudo_file_open() will not be honored by open_sudoers().
Affected settings include ignore_perms, sudoers mode, uid and gid.
This commit is contained in:
Todd C. Miller
2023-09-27 15:16:18 -06:00
parent b2f8c5666d
commit 9cc57f4936

View File

@@ -72,10 +72,10 @@ sudo_file_open(struct sudoers_context *ctx, struct sudo_nss *nss)
handle = malloc(sizeof(*handle));
if (handle != NULL) {
init_parser(ctx, NULL);
handle->fp = open_sudoers(ctx->parser_conf.sudoers_path, &outfile,
false, NULL);
if (handle->fp != NULL) {
init_parser(ctx, NULL);
init_parse_tree(&handle->parse_tree, NULL, NULL, ctx, nss);
if (outfile != NULL) {
/* Update path to open sudoers file. */