mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 06:45:10 +00:00
Don't close sudoers_fp, keep it open and set close on exec flag instead.
This commit is contained in:
4
parse.c
4
parse.c
@@ -125,10 +125,6 @@ sudoers_lookup(pwflag)
|
|||||||
set_perms(PERM_RUNAS);
|
set_perms(PERM_RUNAS);
|
||||||
error = yyparse();
|
error = yyparse();
|
||||||
|
|
||||||
/* Close the sudoers file now that we are done with it. */
|
|
||||||
(void) fclose(sudoers_fp);
|
|
||||||
sudoers_fp = NULL;
|
|
||||||
|
|
||||||
if (error || parse_error) {
|
if (error || parse_error) {
|
||||||
set_perms(PERM_ROOT);
|
set_perms(PERM_ROOT);
|
||||||
return(VALIDATE_ERROR);
|
return(VALIDATE_ERROR);
|
||||||
|
1
sudo.c
1
sudo.c
@@ -915,6 +915,7 @@ check_sudoers()
|
|||||||
if (sudoers_fp == NULL)
|
if (sudoers_fp == NULL)
|
||||||
log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS);
|
log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS);
|
||||||
}
|
}
|
||||||
|
(void) fcntl(fileno(sudoers_fp), F_SETFD, 1);
|
||||||
|
|
||||||
set_perms(PERM_ROOT); /* change back to root */
|
set_perms(PERM_ROOT); /* change back to root */
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user