From: Todd C. Miller Date: Tue, 20 Jan 2004 19:18:44 +0000 (+0000) Subject: Prefer VISUAL over EDITOR like old vipw did. X-Git-Tag: SUDO_1_6_8~224 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f068ee01c4ced84c5b8829d1699a546dc4ad25b7;p=sudo Prefer VISUAL over EDITOR like old vipw did. --- diff --git a/visudo.c b/visudo.c index ed2f60a8a..cf3dfdba6 100644 --- a/visudo.c +++ b/visudo.c @@ -246,13 +246,13 @@ main(argc, argv) (void) close(stmp_fd); /* - * Check EDITOR and VISUAL environment variables to see which editor + * Check VISUAL and EDITOR environment variables to see which editor * the user wants to use (we may not end up using it though). * If the path is not fully-qualified, make it so and check that * the specified executable actually exists. */ - if ((UserEditor = getenv("EDITOR")) == NULL || *UserEditor == '\0') - UserEditor = getenv("VISUAL"); + if ((UserEditor = getenv("VISUAL")) == NULL || *UserEditor == '\0') + UserEditor = getenv("EDITOR"); if (UserEditor && *UserEditor == '\0') UserEditor = NULL; else if (UserEditor) { diff --git a/visudo.pod b/visudo.pod index 9f84d3861..c6c06c33e 100644 --- a/visudo.pod +++ b/visudo.pod @@ -59,13 +59,13 @@ There is a hard-coded list of editors that B will use set at compile-time that may be overridden via the I I C variable. This list defaults to the path to vi(1) on your system, as determined by the I script. Normally, -B does not honor the C or C environment +B does not honor the C or C environment variables unless they contain an editor in the aforementioned editors list. However, if B is configured with the I<--with-enveditor> flag or the I C variable is set in I, -B will use any the editor defines by C or C. +B will use any the editor defines by C or C. Note that this can be a security hole since it allows the user to -execute any program they wish simply by setting C or C. +execute any program they wish simply by setting C or C. B parses the I file after the edit and will not save the changes if there is a syntax error. Upon finding @@ -156,8 +156,8 @@ mode these are errors, not warnings. The following environment variables are used only if B was configured with the I<--with-env-editor> option: - EDITOR Invoked by visudo as the editor to use - VISUAL Used by visudo if EDITOR is not set + VISUAL Invoked by visudo as the editor to use + EDITOR Used by visudo if VISUAL is not set =head1 FILES