additional improvements for domain verification

This commit is contained in:
Serghey Rodin 2013-01-04 18:06:46 +02:00
commit ca23ae66d2
2 changed files with 31 additions and 36 deletions

View file

@ -49,15 +49,21 @@ get_domain_values 'web'
# Check if it a simple domain
if [ $(echo -e "${dom_alias//\./\n}" | wc -l) -le 2 ]; then
if [ ! -e "$USER_DATA/dns/$dom_alias.conf" ]; then
$BIN/v-add-dns-domain $user $dom_alias $IP '' '' '' '' '' $restart
$BIN/v-add-dns-domain \
$user $dom_alias $IP '' '' '' '' '' $restart > /dev/null
fi
else
# Check subdomain
sub=$(echo "$dom_alias" | cut -f1 -d . -s)
dom=$(echo "$dom_alias" | sed -e "s/^$sub.//" )
if [ ! -e "$USER_DATA/dns/$dom.conf" ]; then
$BIN/v-add-dns-domain $user $dom $IP '' '' '' '' '' $restart
$BIN/v-add-dns-domain-record $user $dom "$sub" A $IP '' '' $restart
$BIN/v-add-dns-domain \
$user $dom $IP '' '' '' '' '' $restart > /dev/null
if [ $? -eq 0 ]; then
$BIN/v-add-dns-domain-record \
$user $dom "$sub" A $IP '' '' $restart
fi
else
if [ "$sub" == '*' ]; then
rec=$(grep -w "RECORD='\*'" $USER_DATA/dns/$dom.conf)
@ -65,7 +71,8 @@ else
rec=$(grep -w "RECORD='$sub'" $USER_DATA/dns/$dom.conf)
fi
if [ -z "$rec" ]; then
$BIN/v-add-dns-domain-record $user $dom "$sub" A $IP '' '' $restart
$BIN/v-add-dns-domain-record \
$user $dom "$sub" A $IP '' '' $restart > /dev/null
fi
fi
fi

View file

@ -105,62 +105,50 @@ is_domain_new() {
c2=$(grep "'$dom," $VESTA/data/users/*/web.conf | cut -f 7 -d /)
c3=$(grep ",$dom," $VESTA/data/users/*/web.conf | cut -f 7 -d /)
c4=$(grep ",$dom'" $VESTA/data/users/*/web.conf | cut -f 7 -d /)
if [ ! -z "$c1" ] && [ "$type" != "web" ]; then
if [ ! -z "$c1" ] && [ "$type" == "web" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
if [ ! -z "$c1" ]; then
c1_user=$(echo "$c1" |cut -f 7 -d /)
if [ "$c1_user" != "$user" ]; then
if [ ! -z "$c1" ] && [ "$c1" != "$user" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
fi
if [ ! -z "$c2" ] && [ "$type" != "web" ]; then
if [ ! -z "$c2" ] && [ "$type" == "web" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
if [ ! -z "$c2" ]; then
c2_user=$(echo "$c2" |cut -f 7 -d /)
if [ "$c2_user" != "$user" ]; then
if [ ! -z "$c2" ] && [ "$c2" != "$user" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
fi
if [ ! -z "$c3" ] && [ "$type" != "web" ]; then
if [ ! -z "$c3" ] && [ "$type" == "web" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
if [ ! -z "$c3" ]; then
c3_user=$(echo "$c3" |cut -f 7 -d /)
if [ "$c3_user" != "$user" ]; then
if [ ! -z "$c3" ] && [ "$c3" != "$user" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
fi
if [ ! -z "$c4" ] && [ "$type" != "web" ]; then
if [ ! -z "$c4" ] && [ "$type" == "web" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
if [ ! -z "$c4" ]; then
c1_user=$(echo "$c4" |cut -f 7 -d /)
if [ "$c4_user" != "$user" ]; then
if [ ! -z "$c4" ] && [ "$c4" != "$user" ]; then
echo "Error: domain $dom exist"
log_event "$E_EXISTS" "$EVENT"
exit $E_EXISTS
fi
fi
fi
}
# Checking mail account existance