Skip to content

Commit e64049a

Browse files
authored
Fix DNS issue whit some characters
This will fix issues commented here: outroll/vesta#1087 Changes: 1- Prevent user to add record as: record* or ** of *record only can add record if has * or *. so only valid wildcards 2- Prevent add records as record has record. record.. record-- record- 3- Prevent add records as -record .record and leave user add _record needed for dmarc, dkim and orther 4- prevent add dual special characters record..record or record--recoerd or record__record or record........record
1 parent 593dd29 commit e64049a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

func/main.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,25 @@ is_common_format_valid() {
594594
check_result $E_INVALID "invalid $2 format :: $1"
595595
fi
596596
if [[ $1 =~ \* ]]; then
597-
if [ "$(echo $1 | grep -o '*'|wc -l)" -gt 1 ]; then
598-
check_result $E_INVALID "invalid $2 format :: $1"
597+
if [[ "$(echo $1 | grep -o \*\. |wc -l)" -eq 0 ]] && [[ $1 != '*' ]] ; then
598+
check_result $E_INVALID "invalid $2 format :: $1"
599599
fi
600600
fi
601+
if [[ $(echo -n "$1" | tail -c 1) =~ [^a-zA-Z0-9_*@] ]]; then
602+
check_result $E_INVALID "invalid $2 format :: $1"
603+
fi
604+
if [[ $(echo -n "$1" | grep -c '\.\.') -gt 0 ]];then
605+
check_result $E_INVALID "invalid $2 format :: $1"
606+
fi
607+
if [[ $(echo -n "$1" | head -c 1) =~ [^a-zA-Z0-9_*@] ]]; then
608+
check_result $E_INVALID "invalid $2 format :: $1"
609+
fi
610+
if [[ $(echo -n "$1" | grep -c '\-\-') -gt 0 ]]; then
611+
check_result $E_INVALID "invalid $2 format :: $1"
612+
fi
613+
if [[ $(echo -n "$1" | grep -c '\_\_') -gt 0 ]]; then
614+
check_result $E_INVALID "invalid $2 format :: $1"
615+
fi
601616
}
602617

603618
# Database format validator

0 commit comments

Comments
 (0)