mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 18:49:17 -07:00
completed about 20% of email api
This commit is contained in:
parent
af54a85367
commit
8f6fbfc0e8
12 changed files with 668 additions and 59 deletions
|
@ -1,19 +1,19 @@
|
|||
# Checking domain existance
|
||||
is_domain_new() {
|
||||
config_type="$1"
|
||||
dom=${2-domain}
|
||||
dom=${2-$domain}
|
||||
check_all=$(grep -w $dom $V_USERS/*/*.conf)
|
||||
if [ ! -z "$check_all" ]; then
|
||||
check_ownership=$(grep -w $dom $V_USERS/$user/*.conf)
|
||||
if [ ! -z "$check_ownership" ]; then
|
||||
check_type=$(grep -w $dom $V_USERS/$user/$config_type.conf)
|
||||
if [ ! -z "$check_type" ]; then
|
||||
echo "Error: $dom exist"
|
||||
echo "Error: domain $dom exist"
|
||||
log_event 'debug' "$E_EXISTS $V_EVENT"
|
||||
exit $E_EXISTS
|
||||
fi
|
||||
else
|
||||
echo "Error: $dom exist"
|
||||
echo "Error: domain $dom exist"
|
||||
log_event 'debug' "$E_EXISTS $V_EVENT"
|
||||
exit $E_EXISTS
|
||||
fi
|
||||
|
@ -26,7 +26,7 @@ is_domain_valid() {
|
|||
|
||||
# Checking result
|
||||
if [ -z "$check_domain" ]; then
|
||||
echo "Error: domain not exist"
|
||||
echo "Error: domain $domain not exist"
|
||||
log_event 'debug' "$E_NOTEXIST $V_EVENT"
|
||||
exit $E_NOTEXIST
|
||||
fi
|
||||
|
@ -111,7 +111,7 @@ update_domain_zone() {
|
|||
|
||||
# Converting utf records to ascii
|
||||
RECORD=$(idn --quiet -a -t "$RECORD")
|
||||
VALUE=$(idn --quiet -a -t "$VALUE")
|
||||
#VALUE=$(idn --quiet -a -t "$VALUE")
|
||||
eval echo -e "\"$fields\""|sed -e "s/%quote%/'/g" >> $conf
|
||||
done < $V_USERS/$user/dns/$domain
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ is_domain_key_empty() {
|
|||
|
||||
# Checkng key
|
||||
if [ ! -z "$value" ] && [ "$value" != 'no' ]; then
|
||||
echo "Error: value is not empty = $value"
|
||||
echo "Error: ${key//$} is not empty = $value"
|
||||
log_event 'debug' "$E_EXISTS $V_EVENT"
|
||||
exit $E_EXISTS
|
||||
fi
|
||||
|
|
|
@ -329,6 +329,26 @@ format_validation() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Defining format_bit function
|
||||
format_bit() {
|
||||
val="$1"
|
||||
case $val in
|
||||
128) known='yes';;
|
||||
256) known='yes';;
|
||||
512) known='yes';;
|
||||
768) known='yes';;
|
||||
1024) known='yes';;
|
||||
2048) known='yes';;
|
||||
*) known='no';;
|
||||
esac
|
||||
|
||||
if [[ "$known" != 'yes' ]]; then
|
||||
echo "Error: $var is out of range"
|
||||
log_event 'debug' "$E_INVALID $V_EVENT"
|
||||
exit $E_INVALID
|
||||
fi
|
||||
}
|
||||
|
||||
# Defining format_ext function
|
||||
format_ext() {
|
||||
val="$1"
|
||||
|
@ -375,14 +395,15 @@ format_validation() {
|
|||
case $var in
|
||||
antispam) format_bool "$v" ;;
|
||||
antivirus) format_bool "$v" ;;
|
||||
dom_alias) format_dom "$v" ;;
|
||||
auth_pass) format_pwd "$v" ;;
|
||||
auth_user) format_usr "$v" ;;
|
||||
ssl) format_usr "$v" ;;
|
||||
domain) format_dom "$v" ;;
|
||||
database) format_db "$v" ;;
|
||||
day) format_mhd "$v" ;;
|
||||
db_user) format_dbu "$v" ;;
|
||||
domain) format_dom "$v" ;;
|
||||
dom_alias) format_dom "$v" ;;
|
||||
dkim) format_bool "$v" ;;
|
||||
dkim_size) format_bit "$v" ;;
|
||||
dvalue) format_dvl "$v" ;;
|
||||
fname) format_usr "$v" ;;
|
||||
job) format_int "$v" ;;
|
||||
|
@ -415,6 +436,7 @@ format_validation() {
|
|||
password) format_pwd "$v" ;;
|
||||
port) format_int "$v" ;;
|
||||
rtype) format_rcd "$v" ;;
|
||||
ssl) format_usr "$v" ;;
|
||||
shell) format_sh "$v" ;;
|
||||
soa) format_dom "$v" ;;
|
||||
suspend_url) format_url "$v" ;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue