mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Ignore set_logname (which is now the default) for sudoedit since
we want the LOGNAME, USER and USERNAME environment variables to refer to the calling user since that is who the editor runs as. This allows the editor to find the user's startup files. Fixes bugzilla #515
This commit is contained in:
@@ -586,8 +586,13 @@ rebuild_env(void)
|
||||
SET(didvar, DID_PATH);
|
||||
}
|
||||
|
||||
/* Set $USER, $LOGNAME and $USERNAME to target if "set_logname" is true. */
|
||||
if (def_set_logname && !ISSET(sudo_mode, MODE_LOGIN_SHELL)) {
|
||||
/*
|
||||
* Set $USER, $LOGNAME and $USERNAME to target if "set_logname" is not
|
||||
* disabled. We skip this if we are running a login shell (because
|
||||
* they have already been set them) or sudoedit (because we want the
|
||||
* editor to find the user's startup files).
|
||||
*/
|
||||
if (def_set_logname && !ISSET(sudo_mode, MODE_LOGIN_SHELL|MODE_EDIT)) {
|
||||
if (!ISSET(didvar, KEPT_LOGNAME))
|
||||
sudo_setenv("LOGNAME", runas_pw->pw_name, TRUE);
|
||||
if (!ISSET(didvar, KEPT_USER))
|
||||
|
Reference in New Issue
Block a user