If the user specified a uid with the -u flag and the uid exists in
the passwd file, set runas_user to the name, not the uid. When comparing usernames in sudoers, if a name is really a uid (starts with '#') compare it numerically to pw_uid.
This commit is contained in:
2
sudo.c
2
sudo.c
@@ -574,6 +574,8 @@ init_vars(sudo_mode)
|
||||
log_error(USE_ERRNO|MSG_ONLY, "can't get hostname");
|
||||
|
||||
set_runaspw(*user_runas); /* may call log_error() */
|
||||
if (*user_runas[0] == '#' && runas_pw->pw_name && runas_pw->pw_name[0])
|
||||
*user_runas = estrdup(runas_pw->pw_name);
|
||||
|
||||
/*
|
||||
* Get current working directory. Try as user, fall back to root.
|
||||
|
Reference in New Issue
Block a user