reresolve-dns: remove invalid anchors on regex match

Reported-by: Conrad Meyer <cem@freebsd.org>
This commit is contained in:
Jason A. Donenfeld 2019-11-27 13:30:43 +01:00
parent 1f96cdcc04
commit cf3948dab5
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ INTERFACE="${BASH_REMATCH[1]}"
process_peer() {
[[ $PEER_SECTION -ne 1 || -z $PUBLIC_KEY || -z $ENDPOINT ]] && return 0
[[ $(wg show "$INTERFACE" latest-handshakes) =~ ^${PUBLIC_KEY//+/\\+}\ ([0-9]+)$ ]] || return 0
[[ $(wg show "$INTERFACE" latest-handshakes) =~ ${PUBLIC_KEY//+/\\+}\ ([0-9]+) ]] || return 0
(( ($(date +%s) - ${BASH_REMATCH[1]}) > 135 )) || return 0
wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT"
reset_peer_section