mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Set runas_pw early and adjust runaslist_matches() to deal. Since
we now set runas_default early there is no need to call update_defaults with SETDEF_RUNAS after sudoers has been parsed.
This commit is contained in:
@@ -261,6 +261,17 @@ main(int argc, char *argv[])
|
||||
/* Allocate space for data structures in the parser. */
|
||||
init_parser("sudoers", false);
|
||||
|
||||
/*
|
||||
* Set runas passwd/group entries based on command line or sudoers.
|
||||
* Note that if runas_group was specified without runas_user we
|
||||
* run the command as the invoking user.
|
||||
*/
|
||||
if (runas_group != NULL) {
|
||||
set_runasgr(runas_group);
|
||||
set_runaspw(runas_user ? runas_user : user_name);
|
||||
} else
|
||||
set_runaspw(runas_user ? runas_user : def_runas_default);
|
||||
|
||||
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, NULL);
|
||||
if (sudoersparse() != 0 || parse_error) {
|
||||
parse_error = true;
|
||||
@@ -277,18 +288,6 @@ main(int argc, char *argv[])
|
||||
(void) fputs(" (problem with defaults entries)", stdout);
|
||||
puts(".");
|
||||
|
||||
/*
|
||||
* Set runas passwd/group entries based on command line or sudoers.
|
||||
* Note that if runas_group was specified without runas_user we
|
||||
* defer setting runas_pw so the match routines know to ignore it.
|
||||
*/
|
||||
if (runas_group != NULL) {
|
||||
set_runasgr(runas_group);
|
||||
if (runas_user != NULL)
|
||||
set_runaspw(runas_user);
|
||||
} else
|
||||
set_runaspw(runas_user ? runas_user : def_runas_default);
|
||||
|
||||
if (dflag) {
|
||||
(void) putchar('\n');
|
||||
dump_sudoers();
|
||||
|
Reference in New Issue
Block a user