2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Looser owner/permission checks for an uninstalled sudoers file.

We don't check the owner or permissions on a sudoers file that is
specified as an argument to visudo by default.  However, the owner
and mode of files included via @includedir were still checked.  This
commit makes the owner and permissions checks for filed included
via @includedir follow the same as for the original sudoers file.
This commit is contained in:
Todd C. Miller 2022-03-11 10:44:17 -07:00
parent b2a32f95ee
commit ef4ce5c08a

View File

@ -229,8 +229,16 @@ main(int argc, char *argv[])
usage(1);
}
/* Check/set owner and mode for installed sudoers file. */
if (!fflag) {
if (fflag) {
/* Looser owner/permission checks for an uninstalled sudoers file. */
if (!use_owner) {
sudoers_uid = -1;
sudoers_gid = -1;
}
if (!use_perms)
SET(sudoers_mode, S_IWUSR);
} else {
/* Check/set owner and mode for installed sudoers file. */
use_owner = true;
use_perms = true;
}