mirror of
https://github.com/myvesta/vesta
synced 2025-08-21 05:44:08 -07:00
Fix DNS issue whit some characters
This will fix issues commented here: https://github.com/serghey-rodin/vesta/issues/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
This commit is contained in:
parent
593dd29956
commit
e64049af0e
1 changed files with 17 additions and 2 deletions
17
func/main.sh
17
func/main.sh
|
@ -594,10 +594,25 @@ is_common_format_valid() {
|
||||||
check_result $E_INVALID "invalid $2 format :: $1"
|
check_result $E_INVALID "invalid $2 format :: $1"
|
||||||
fi
|
fi
|
||||||
if [[ $1 =~ \* ]]; then
|
if [[ $1 =~ \* ]]; then
|
||||||
if [ "$(echo $1 | grep -o '*'|wc -l)" -gt 1 ]; then
|
if [[ "$(echo $1 | grep -o \*\. |wc -l)" -eq 0 ]] && [[ $1 != '*' ]] ; then
|
||||||
check_result $E_INVALID "invalid $2 format :: $1"
|
check_result $E_INVALID "invalid $2 format :: $1"
|
||||||
fi
|
fi
|
||||||
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
|
# Database format validator
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue