]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: darwin: prefer system paths for tools
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 12 Aug 2018 07:28:28 +0000 (00:28 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 12 Aug 2018 07:28:28 +0000 (00:28 -0700)
The only things wg-quick(8) needs from Homebrew are bash(1) and wg(8).
Other than that, it's explicitly coded against the native system
utilities. Since wg-quick(8) and bash(1) are invoked in auto_su by their
full absolute path (via $SELF and $BASH, respectively), we can simply
set the $PATH to be prefixed by the default system binary paths. This
way, if users install tools that conflict with system tools -- such as
GNU coreutils -- we won't accidently call those.

Reported-by: Deirdre Connolly <durumcrustulum@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/darwin.bash

index ece16f2756df51076e8da5ca0e4b8cbb8faaab60..30f35419c9ee0953b388b6fd556c1ff887ae8e0c 100755 (executable)
@@ -11,7 +11,7 @@ export LC_ALL=C
 SELF="${BASH_SOURCE[0]}"
 [[ $SELF == */* ]] || SELF="./$SELF"
 SELF="$(cd "${SELF%/*}" && pwd -P)/${SELF##*/}"
-export PATH="${SELF%/*}:$PATH"
+export PATH="/usr/bin:/bin:/usr/sbin:/sbin:${SELF%/*}:$PATH"
 
 WG_CONFIG=""
 INTERFACE=""