2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Cleanup sudoers sources on denial and error too.

This commit is contained in:
Todd C. Miller
2021-02-12 19:52:11 -07:00
parent 520db741b5
commit 197d6600fa

View File

@@ -644,15 +644,6 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
goto done;
}
/* Cleanup sudoers sources */
TAILQ_FOREACH(nss, snl, entries) {
nss->close(nss);
}
snl = NULL;
if (def_group_plugin)
group_plugin_unload();
init_parser(NULL, false, false);
if (ISSET(sudo_mode, (MODE_VALIDATE|MODE_CHECK|MODE_LIST))) {
/* ret already set appropriately */
goto done;
@@ -756,6 +747,15 @@ bad:
ret = false;
done:
/* Cleanup sudoers sources */
TAILQ_FOREACH(nss, snl, entries) {
nss->close(nss);
}
snl = NULL;
if (def_group_plugin)
group_plugin_unload();
init_parser(NULL, false, false);
if (ret == -1) {
/* Free stashed copy of the environment. */
(void)env_init(NULL);