mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-28 12:57:50 +00:00
Only check SUDO_USER if euid is 0
This commit is contained in:
parent
f85e95329f
commit
54efa54c0e
@ -134,7 +134,7 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct sudoersfile *sp;
|
struct sudoersfile *sp;
|
||||||
char *user, *editor, **editor_argv;
|
char *editor, **editor_argv;
|
||||||
int ch, oldlocale, editor_argc, exitcode = 0;
|
int ch, oldlocale, editor_argc, exitcode = 0;
|
||||||
bool quiet, strict, oldperms;
|
bool quiet, strict, oldperms;
|
||||||
const char *export_path;
|
const char *export_path;
|
||||||
@ -215,9 +215,11 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Mock up a fake sudo_user struct. */
|
/* Mock up a fake sudo_user struct. */
|
||||||
user_cmnd = user_base = "";
|
user_cmnd = user_base = "";
|
||||||
user = getenv("SUDO_USER");
|
if (geteuid() == 0) {
|
||||||
if (user != NULL && *user != '\0')
|
const char *user = getenv("SUDO_USER");
|
||||||
sudo_user.pw = sudo_getpwnam(user);
|
if (user != NULL && *user != '\0')
|
||||||
|
sudo_user.pw = sudo_getpwnam(user);
|
||||||
|
}
|
||||||
if (sudo_user.pw == NULL) {
|
if (sudo_user.pw == NULL) {
|
||||||
if ((sudo_user.pw = sudo_getpwuid(getuid())) == NULL)
|
if ((sudo_user.pw = sudo_getpwuid(getuid())) == NULL)
|
||||||
sudo_fatalx(U_("you do not exist in the %s database"), "passwd");
|
sudo_fatalx(U_("you do not exist in the %s database"), "passwd");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user