Skip to content

Commit c9f8c5a

Browse files
committed
improved dns record validation
1 parent 5e6ad34 commit c9f8c5a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

func/main.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,22 @@ validate_format_common() {
764764
log_event "$E_INVALID" "$EVENT"
765765
exit $E_INVALID
766766
fi
767+
if [[ "$1" =~ @ ]] && [ ${#1} -gt 1 ] ; then
768+
echo "Error: @ can not be mixed"
769+
log_event "$E_INVALID" "$EVENT"
770+
exit $E_INVALID
771+
fi
772+
if [[ $1 =~ \* ]]; then
773+
if [[ ! $1 =~ \*$ ]]; then
774+
echo "Error: * can be used only at the end"
775+
log_event "$E_INVALID" "$EVENT"
776+
exit $E_INVALID
777+
fi
778+
if [ "$(echo $1 | grep -o '*'|wc -l)" -gt 1 ]; then
779+
log_event "$E_INVALID" "$EVENT"
780+
echo "Error: * can be used only once"
781+
fi
782+
fi
767783
}
768784

769785
# DNS record value

0 commit comments

Comments
 (0)