wg-quick: make darwin and freebsd path search strict like linux

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-04-23 18:16:16 +09:00
parent 090639ae90
commit c2355e00aa
2 changed files with 4 additions and 2 deletions

View file

@ -47,7 +47,8 @@ parse_options() {
CONFIG_FILE="$1" CONFIG_FILE="$1"
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
for path in "${CONFIG_SEARCH_PATHS[@]}"; do for path in "${CONFIG_SEARCH_PATHS[@]}"; do
[[ -e $path/$CONFIG_FILE.conf ]] && { CONFIG_FILE="$path/$CONFIG_FILE.conf"; break; } CONFIG_FILE="$path/$1.conf"
[[ -e $CONFIG_FILE ]] && break
done done
fi fi
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist" [[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"

View file

@ -64,7 +64,8 @@ parse_options() {
CONFIG_FILE="$1" CONFIG_FILE="$1"
if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then if [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]]; then
for path in "${CONFIG_SEARCH_PATHS[@]}"; do for path in "${CONFIG_SEARCH_PATHS[@]}"; do
[[ -e $path/$CONFIG_FILE.conf ]] && { CONFIG_FILE="$path/$CONFIG_FILE.conf"; break; } CONFIG_FILE="$path/$1.conf"
[[ -e $CONFIG_FILE ]] && break
done done
fi fi
[[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist" [[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist"