1 (edited by Thien Hai 2016-06-08 10:07:05)

Topic: Quota domain limit not working

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: Centos 7 x86_64
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? MySQL
- Related log if you're reporting an issue:
====
Hi guys,

I have a problem quota domain limit
- If all account set quota > it work > no problem
- If one or all account set quota limit to 0 > domain limit not work > user can send and receive without quota domain limit
- Can disable admin domain set quota user limit = 0 ?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Quota domain limit not working

Thien Hai wrote:

- If one or all account set quota limit to 0 > domain limit not work > user can send and receive without quota domain limit

*) Do you have a domain quota?
*) you have domain quota, and still able to set per-user mailbox quota to 0 (means unlimited)?
*) Do you set per-user mailbox quota with iRedAdmin-Pro or SQL command line tool?

3

Re: Quota domain limit not working

ZhangHuangbin wrote:
Thien Hai wrote:

- If one or all account set quota limit to 0 > domain limit not work > user can send and receive without quota domain limit

*) Do you have a domain quota?
*) you have domain quota, and still able to set per-user mailbox quota to 0 (means unlimited)?
*) Do you set per-user mailbox quota with iRedAdmin-Pro or SQL command line tool?

Yup,

Domain quota have set limit, if user still set mailbox quota to 0, this user can use unlimit quota without domain quota
I set quota on webadmin not command line tool
Can't control quota domain if domain admin set mailbox to 0

4

Re: Quota domain limit not working

Sorry about this trouble. I will try to reproduce this issue and come back with a fix later.

5

Re: Quota domain limit not working

Dear Thien,

Confirmed that it's a bug of the latest iRedAdmin-Pro-SQL. Here's patch to fix it, if you're not familiar with patch, i can mail you a patched version. We will release a new release soon.

--- a/libs/sqllib/user.py    2016-05-03 10:55:43.000000000 +0800
+++ b/libs/sqllib/user.py    2016-06-14 22:56:41.000000000 +0800
@@ -537,14 +537,21 @@
     # Get quota from <form>
     mail_quota = str(form.get('mailQuota')).strip()
     default_user_quota = domain_settings.get('default_user_quota', 0)
+    max_user_quota = domain_settings.get('max_user_quota', 0)
 
     if mail_quota.isdigit():
         mail_quota = int(mail_quota)
     else:
-        mail_quota = default_user_quota
+        mail_quota = 0
 
     # Re-calculate mail quota if this domain has limited max quota.
     if domain_profile.maxquota > 0:
+        if mail_quota == 0:
+            if default_user_quota:
+                mail_quota = default_user_quota
+            elif max_user_quota:
+                mail_quota = max_user_quota
+
         # Get used quota.
         allocated_quota = sql_lib_domain.sum_allocated_domain_quota(conn=conn, domain=domain)
 
@@ -557,7 +564,6 @@
             # No enough quota.
             return (False, 'EXCEEDED_DOMAIN_QUOTA_SIZE')
 
-    max_user_quota = domain_settings.get('max_user_quota', 0)
     if max_user_quota > 0:
         if mail_quota > max_user_quota:
             mail_quota = max_user_quota

6

Re: Quota domain limit not working

Dear ZhangHuangbin
Can send mail me patch, i change with this your fix but still not working
Thanks

7

Re: Quota domain limit not working

Hi Thien,

I sent you a patched version of iRedAdmin-Pro, please follow our tutorial to upgrade it (just like upgrading a new iRedAdmin-Pro release):
http://www.iredmail.org/docs/migrate.or … admin.html