From 60ab2966a269ed62b91637dbe09030381919d399 Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Mon, 7 Nov 2022 12:18:44 -0700 Subject: [PATCH] Switch to singular case (should only return one) --- back/lib/admin/peer/del | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/back/lib/admin/peer/del b/back/lib/admin/peer/del index 28e90d0..db1b36d 100755 --- a/back/lib/admin/peer/del +++ b/back/lib/admin/peer/del @@ -53,14 +53,14 @@ if ! wg_output="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then fi # Filter out this user's -user_peers="$(grep "${pubkey}" <<<"${wg_output}" 2>/dev/null)" -if [ "${user_peers}" == "" ]; then +user_peer="$(grep "${pubkey}" <<<"${wg_output}" 2>/dev/null)" +if [ "${user_peer}" == "" ]; then printf "ERROR! %s accessed the dashboard but isn't on the network!\n" "${ip}" >>"${LOGFILE}" exit 8 fi # Get peer domains -if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peers}" | grep "${pubkey}")"; then +if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peer}" | grep "${pubkey}")"; then printf 'ERROR! Peer %s not found!\n' "${pubkey}" >>"${LOGFILE}" & printf 'Peer not found\n' | "${LIB_DIR}/http_res" 404 exit 6