wg-quick: allow for tabs in keys

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2017-11-09 14:12:06 +09:00
parent d8ad40da25
commit e0775354bd
2 changed files with 20 additions and 20 deletions

View file

@ -25,8 +25,8 @@ reset_peer_section() {
reset_peer_section
while read -r line || [[ -n $line ]]; do
key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
key="${line%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${line#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
[[ $key == "["* ]] && { process_peer; reset_peer_section; }
[[ $key == "[Peer]" ]] && PEER_SECTION=1
if [[ $PEER_SECTION -eq 1 ]]; then

View file

@ -35,8 +35,8 @@ parse_options() {
INTERFACE="${BASH_REMATCH[1]}"
shopt -s nocasematch
while read -r line || [[ -n $line ]]; do
key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
key="${line%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${line#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
[[ $key == "["* ]] && interface_section=0
[[ $key == "[Interface]" ]] && interface_section=1
if [[ $interface_section -eq 1 ]]; then