Skip to content

Commit de6eb64

Browse files
Merge pull request hestiacp#1091 from Skamasle/patch-16
Fix DNS issue whit some characters
2 parents 1657ebd + 22084a7 commit de6eb64

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)