unlimited quota support

This commit is contained in:
Serghey Rodin 2015-05-29 19:48:34 +03:00
commit 7281a4b5bb
2 changed files with 23 additions and 3 deletions

View file

@ -28,7 +28,10 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
check_args '4' "$#" 'USER DOMAIN ACCOUNT QUOTA'
validate_format 'user' 'domain' 'account' 'quota'
validate_format 'user' 'domain' 'account'
if [ "$quota" != 'unlimited' ]; then
validate_format 'quota'
fi
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
@ -44,6 +47,9 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
md5=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$MD5')
if [[ "$MAIL_SYSTEM" =~ exim ]]; then
if [ "$quota" = 'unlimited' ]; then
quota=0
fi
sed -i "/^$account:/d" $HOMEDIR/$user/conf/mail/$domain/passwd
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd
@ -54,6 +60,10 @@ fi
# Vesta #
#----------------------------------------------------------#
if [[ "$quota" -eq 0 ]]; then
quota='unlimited'
fi
# Update quota
update_object_value "mail/$domain" 'ACCOUNT' "$account" '$QUOTA' "$quota"