now uses list_matches()
This commit is contained in:
17
sudo.c
17
sudo.c
@@ -221,13 +221,6 @@ int main(argc, argv)
|
|||||||
cmnd = "kill";
|
cmnd = "kill";
|
||||||
break;
|
break;
|
||||||
case MODE_LIST:
|
case MODE_LIST:
|
||||||
/*
|
|
||||||
* XXX - want to require a password for -l
|
|
||||||
* since people can be exempt we need to stuff
|
|
||||||
* normal output of "sudo -l" into an array and
|
|
||||||
* grow it as is required, then print out after
|
|
||||||
* the user has been authenticated.
|
|
||||||
*/
|
|
||||||
cmnd = "list";
|
cmnd = "list";
|
||||||
printmatches = 1;
|
printmatches = 1;
|
||||||
break;
|
break;
|
||||||
@@ -300,16 +293,12 @@ int main(argc, argv)
|
|||||||
} else if (sudo_mode == MODE_KILL) {
|
} else if (sudo_mode == MODE_KILL) {
|
||||||
remove_timestamp(); /* remove the timestamp ticket file */
|
remove_timestamp(); /* remove the timestamp ticket file */
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (sudo_mode == MODE_LIST) {
|
|
||||||
log_error(ALL_SYSTEMS_GO);
|
|
||||||
(void) validate(FALSE);
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_env(!(sudo_mode & MODE_SHELL)); /* add in SUDO_* envariables */
|
add_env(!(sudo_mode & MODE_SHELL)); /* add in SUDO_* envariables */
|
||||||
|
|
||||||
/* validate the user but don't search for "validate" */
|
/* validate the user but don't search for "validate" */
|
||||||
rtn = validate((sudo_mode != MODE_VALIDATE));
|
rtn = validate((sudo_mode != MODE_VALIDATE && sudo_mode != MODE_LIST));
|
||||||
|
|
||||||
switch (rtn) {
|
switch (rtn) {
|
||||||
|
|
||||||
@@ -320,6 +309,10 @@ int main(argc, argv)
|
|||||||
log_error(ALL_SYSTEMS_GO);
|
log_error(ALL_SYSTEMS_GO);
|
||||||
if (sudo_mode == MODE_VALIDATE)
|
if (sudo_mode == MODE_VALIDATE)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
else if (sudo_mode == MODE_LIST) {
|
||||||
|
list_matches();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* become specified user or root */
|
/* become specified user or root */
|
||||||
set_perms(PERM_RUNAS);
|
set_perms(PERM_RUNAS);
|
||||||
|
Reference in New Issue
Block a user