From 9cc57f4936c0190f75466a38b0401a5275d70ee5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 27 Sep 2023 15:16:18 -0600 Subject: [PATCH] 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. --- plugins/sudoers/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sudoers/file.c b/plugins/sudoers/file.c index 651ece35c..865350a9c 100644 --- a/plugins/sudoers/file.c +++ b/plugins/sudoers/file.c @@ -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. */