challenge: fix behaviour with DNS token: allow pasing the token by pipe

This commit is contained in:
nemunaire 2020-02-24 10:02:12 +01:00
parent 98567d26c9
commit 75abc025e2

View File

@ -87,10 +87,15 @@ case "${TOKENID}" in
exit 2 exit 2
;; ;;
token4) token4)
HDATA=$(dig +short +time=1 +tries=0 adlin.nemunai.re $2 | sed 's/["\\]//g') || { if [ -t 0 ]; then
HDATA=$(dig +short +time=1 +tries=0 adlin.nemunai.re $2) || {
echo "Try again! Your resolver settings seems not good :(" >&2 echo "Try again! Your resolver settings seems not good :(" >&2
exit 3 exit 3
} }
else
read HDATA
fi
HDATA=$(echo "${HDATA}" | sed 's/["\\]//g')
echo $HDATA | grep "not here" 2> /dev/null && exit 3 echo $HDATA | grep "not here" 2> /dev/null && exit 3
;; ;;
*) *)