Merge pull request #1091 from Skamasle/patch-16

Fix DNS issue whit some characters
This commit is contained in:
Serghey Rodin 2017-12-28 14:58:05 +02:00 committed by GitHub
commit de6eb649ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -594,10 +594,25 @@ is_common_format_valid() {
check_result $E_INVALID "invalid $2 format :: $1"
fi
if [[ $1 =~ \* ]]; then
if [ "$(echo $1 | grep -o '*'|wc -l)" -gt 1 ]; then
check_result $E_INVALID "invalid $2 format :: $1"
if [[ "$(echo $1 | grep -o '\*\.' |wc -l)" -eq 0 ]] && [[ $1 != '*' ]] ; then
check_result $E_INVALID "invalid $2 format :: $1"
fi
fi
if [[ $(echo -n "$1" | tail -c 1) =~ [^a-zA-Z0-9_*@] ]]; then
check_result $E_INVALID "invalid $2 format :: $1"
fi
if [[ $(echo -n "$1" | grep -c '\.\.') -gt 0 ]];then
check_result $E_INVALID "invalid $2 format :: $1"
fi
if [[ $(echo -n "$1" | head -c 1) =~ [^a-zA-Z0-9_*@] ]]; then
check_result $E_INVALID "invalid $2 format :: $1"
fi
if [[ $(echo -n "$1" | grep -c '\-\-') -gt 0 ]]; then
check_result $E_INVALID "invalid $2 format :: $1"
fi
if [[ $(echo -n "$1" | grep -c '\_\_') -gt 0 ]]; then
check_result $E_INVALID "invalid $2 format :: $1"
fi
}
# Database format validator