Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 22nd October 2009, 02:14
SrTango SrTango is offline
Junior Member
 
Join Date: Oct 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Posible bug related to quotas and user edit

Hi,
I am experiencing the following behavior.
If I log in as a client and try to edit an user autoresponse. I get the same error as I'd get if I had not enough quota for the mailbox.
That is:
The max space for mailboxes is reached. The max. available space in MB is: 400
but I am in fact under quota (as the error also suggest) and I'm not touching the user quota which is, in this case, 50 MB.
So it seems that when I change tabs to get to the autoresponder tab the value in the quota field is... somewhat lost and mail_user_edit.php can't see it and believes that I want to change the quota to 0 or something like that thus giving me the error message.
I didn't really have the time to properly debug the problem but I hope that the description helps you to understand what I mean and how to reproduce.
Reply With Quote
Sponsored Links
  #2  
Old 22nd October 2009, 13:34
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,041
Thanks: 841
Thanked 5,660 Times in 4,467 Posts
Default

The error means that you assigned too much quota to your mail users as ispconfig calculates the sum of all mailusers assigned to a client. Set the mail quota of the client and / or the reseller to a higher limit.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 22nd October 2009, 17:25
SrTango SrTango is offline
Junior Member
 
Join Date: Oct 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe I did not explain it correctly
I am not over quota
I am not changing the quota the user has already assigned
as the error message says I still have 400MB to assign if I wanted to.
Problem is, when I *only* try to change the autoresponder I get the error even when I am not changing the quota.

If I were over quota the message would say something like The max available space is 0
(or even minus something)
So since I still have 400MB to spare and since I am not changing the 50 mb that the user already have assigned, no error quota related should pop up.
Reply With Quote
  #4  
Old 22nd October 2009, 18:37
damir damir is offline
Senior Member
 
Join Date: Jun 2006
Posts: 375
Thanks: 11
Thanked 51 Times in 42 Posts
Default

Quote:
Originally Posted by SrTango View Post
Maybe I did not explain it correctly
I am not over quota
I am not changing the quota the user has already assigned
as the error message says I still have 400MB to assign if I wanted to.
Problem is, when I *only* try to change the autoresponder I get the error even when I am not changing the quota.

If I were over quota the message would say something like The max available space is 0
(or even minus something)
So since I still have 400MB to spare and since I am not changing the 50 mb that the user already have assigned, no error quota related should pop up.
Im experiencing same problem, i have 500mb quota on my email plan. 100mb is assign to my account and 400 free.

When i move from autoresponder to mailfilter i get the error message. Im not even messing with quota.
Reply With Quote
  #5  
Old 22nd October 2009, 18:43
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,041
Thanks: 841
Thanked 5,660 Times in 4,467 Posts
Default

Quote:
Im not even messing with quota.
This does not matter as quota is tested on every operation that is done on the mailbox.

Which quota settings have you set in the reseller, which have you set in the client and which setting do you have in every mailbox that belongs to the same client and same reseller?
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 22nd October 2009, 23:31
SrTango SrTango is offline
Junior Member
 
Join Date: Oct 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
This does not matter as quota is tested on every operation that is done on the mailbox.

Which quota settings have you set in the reseller, which have you set in the client and which setting do you have in every mailbox that belongs to the same client and same reseller?
That is actually the problem, the code is checking for the quota but for some reason the value is lost somewhere (I think)

My quota setting for this particular example are about 4000MB for the client with a max of around 80 mailboxes.
there are like 72 mailboxes created each of which have 50mb quota.
That leaves me with like 400mb free.
I am not changing the user quota, just changing tabs and trying to set an autoresponder as the client. (it obviously works as admin)
Reply With Quote
  #7  
Old 23rd October 2009, 12:01
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,041
Thanks: 841
Thanked 5,660 Times in 4,467 Posts
Default

You can test it yourself but I doubt that the mysql sum function is broken. Get the record of this mailbox, what we need is the sys_groupid and the mailuser_id. Then execute the following sql statement in the ispconfig database to get the quota of all mailboxes of this client:

SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != [MAILUSER_ID] AND sys_groupid = [SYS_GROUPID]

replace [MAILUSER_ID] and [SYS_GROUPID] with the ID's from the mailbox record.

What you get is the mailbox size in bytes, you have to divide it twice by 1024 to get The size in mbyte.

You will get a quota error if the size of all mailboxes + the size of the current mailbox is > the limit of the client.

Quote:
I am not changing the user quota, just changing tabs and trying to set an autoresponder as the client. (it obviously works as admin)
This does not matter as I posted above. the limits are chcekd on every operation that you do on the mailbox and not only if you change quota.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #8  
Old 23rd October 2009, 16:49
SrTango SrTango is offline
Junior Member
 
Join Date: Oct 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
This does not matter as I posted above. the limits are chcekd on every operation that you do on the mailbox and not only if you change quota.
You miss the point.
The point is, if the quota works and I can change it without any problem, for example changing it from 50 to 40 or 60. it should work when I am *not* changing the quota and just creating an autoresponse. So there should be something wrong with the check, cause it works when I'm using the first tab on the mailbox edit, but it doesn't when I'm using the autoresponse tab.

Then again.
If I take that very same mailbox and I edit the quota, raising it to 80 or lowering to 40 and I save the changes it works ok.
If, on the other hand, I edit the mailbox, change to the autoresponse tab, check the checkbox, set up a message and save the change I get the error message.
Reply With Quote
  #9  
Old 24th October 2009, 18:41
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,041
Thanks: 841
Thanked 5,660 Times in 4,467 Posts
Default

Ok. Added it to the bugtracker.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #10  
Old 10th November 2009, 20:44
chengkinhung chengkinhung is offline
Junior Member
 
Join Date: Nov 2009
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default I try to fix the mail/mail_user_edit.php

the original code:

// Check the quota and adjust
if($client["limit_mailquota"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
$mailquota = $tmp["mailquota"] / 1024 / 1024;
$new_mailbox_quota = intval($this->dataRecord["quota"]);
if(($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) || ($new_mailbox_quota == 0 && $client["limit_mailquota"] != -1)) {
$max_free_quota = $client["limit_mailquota"] - $mailquota;
$app->tform->errorMessage .= $app->tform->lng("limit_mailquota_txt").": ".$max_free_quota."<br>";
// Set the quota field to the max free space
$this->dataRecord["quota"] = $max_free_quota;
}
unset($tmp);
unset($tmp_quota);
}

I change to:

// Check the quota and adjust
if($client["limit_mailquota"] >= 0) {
$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND sys_groupid = $client_group_id");
$mailquota = $tmp["mailquota"] / 1024 / 1024;
$new_mailbox_quota = intval($this->dataRecord["quota"]);
if($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) {
$max_free_quota = $client["limit_mailquota"] - $mailquota;
$app->tform->errorMessage .= $app->tform->lng("limit_mailquota_txt").": ".$max_free_quota."<br>";
// Set the quota field to the max free space
$this->dataRecord["quota"] = $max_free_quota;
}
unset($tmp);
unset($tmp_quota);
}
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:13.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.