2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Call rebuild_env() in call cases.

Pass original envp to sudo_edit().
Don't allow -E or env var setting in sudoedit mode.
More accurate usage() when called as sudoedit.
This commit is contained in:
Todd C. Miller
2007-07-08 18:44:28 +00:00
parent 16166fc5e6
commit 5919eb1fa6
2 changed files with 69 additions and 36 deletions

View File

@@ -60,13 +60,15 @@ __unused static const char rcsid[] = "$Sudo$";
#endif /* lint */
extern sigaction_t saved_sa_int, saved_sa_quit, saved_sa_tstp, saved_sa_chld;
extern char **environ;
/*
* Wrapper to allow users to edit privileged files with their own uid.
*/
int sudo_edit(argc, argv)
int sudo_edit(argc, argv, envp)
int argc;
char **argv;
char **envp;
{
ssize_t nread, nwritten;
pid_t kidpid, pid;
@@ -192,6 +194,7 @@ int sudo_edit(argc, argv)
* based on def_env_editor or def_editor since the editor runs with
* the uid of the invoking user, not the runas (privileged) user.
*/
environ = envp;
if (((editor = getenv("VISUAL")) != NULL && *editor != '\0') ||
((editor = getenv("EDITOR")) != NULL && *editor != '\0')) {
editor = estrdup(editor);