View Full Version : Courier+maildrop are not updating maildirsize
quentusrex
30th October 2008, 18:17
It seems that the file /home/vmail/domain/user/maildirsize is not being updated with the new quota size when the quota is changed by ISPConfig. The hack that seems to fix it is to run the commands:
maildirmake -q {quota}S /home/vmail/domain/user/
chown vmail:vmail /home/vmail/domain/user/maildirsize
right after the quota is changed. I don't know where to add this hack to ISPConfig to fix the bug, if this is even the right hack to do it.
till
30th October 2008, 20:23
Courier and maildrop are configured to read the maildir size directly from the mysql database in the file /etc/courier/authmysqlrc
quentusrex
30th October 2008, 20:29
It is configured to read it when creating the maildir the first time, but it seems to ignore the database after the user is created. I could be wrong, but so far all my tests show that it only looks to the database during initial creation, then ignores the database afterthat(atleast when it comes to quota). But if you manually tell it to recalculate the maildirsize file then it accurately handles changes in mail dir sizes.
till
31st October 2008, 11:12
Ok, then we should add this in the user_update function in the plugin file /usr/local/ispconfig/server/plugins-available/mail_plugin.inc.php
Maybe we find later a reason why maildrop is not recognizing it in the db.
quentusrex
31st October 2008, 11:27
Till, you or me?
I think if I program it I think the code will still need to be cleaned up, but I think I can make it 'work' quickly.
Do you know where I can find an example plugin that executes a command on the command line? Should exec() be used? or avoided?
quentusrex
31st October 2008, 11:29
Ok, never mind. Found it, and a sample.
exec('mkdir -p '.escapeshellcmd($data['new']['maildir']));
exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
till
31st October 2008, 11:51
It is fine to use exec, we dont have a wrapper function for exec (at least yet).
till
31st October 2008, 11:52
Till, you or me?
I will try to fix some of the bugs that are in the bugtracker over the weekend.
quentusrex
31st October 2008, 11:58
I'll see if I can get this bug atleast started. I might be able to make it work.
Till, of the bugs I've seen I would say the one I would need help tracking down in the mail quota size. It's an int overflow bug. It could be a security concern. I don't know if the over flow is in the AJAX side of things, or in the php processing side.
quentusrex
31st October 2008, 12:19
Till, also there seems to be no way to change the log level.
till
31st October 2008, 12:32
The Loglevel is set in the ISPConfig configuration file:
/usr/local/ispconfig/server/lib/config.inc.php
I changed it there and it worked on my setup.
till
31st October 2008, 12:36
I'll see if I can get this bug atleast started. I might be able to make it work.
Till, of the bugs I've seen I would say the one I would need help tracking down in the mail quota size. It's an int overflow bug. It could be a security concern. I don't know if the over flow is in the AJAX side of things, or in the php processing side.
I guess its a database problem, it should be solved if we set the database field from int to "bigint unsigned" as we do not need negative values there as courier recognizs 0 as unlimited.
quentusrex
31st October 2008, 12:56
Alright, I've fixed this bug. it has a bit of a delay. Either that or it waits for something.
till
31st October 2008, 13:01
The update scripts are run as cronjob because they need root priveliges, so it takes up to 1 minute until they get executed.
quentusrex
31st October 2008, 13:03
It's not a database problem. I changed the database structure on my test install to a mysql int(30) from an int(11) and it didn't fix the problem.
I think it's in the AJAX interface, or the php handling of the AJAX int. Where does the value get converted from MB's to bytes? I think that could be where the bug is located.
till
31st October 2008, 13:14
It is converted in PHP. The file is interface/web/mail/mail_user_edit.php if I remember correctly.
quentusrex
31st October 2008, 13:20
Do you think it would be under
Submit, Insert, or update?
till
31st October 2008, 13:32
Most likely line 178 under submit:
// Convert quota from MB to Bytes
$this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
But as far as I know, there is no limit in PHP which might cause problems with big integer numbers *confused*
quentusrex
31st October 2008, 14:03
I've tracked down that it isn't failing there. It's failing in relation to interface/web/mail/form/mail_user.tform.php
I think it's bugging out around line 91. Somewhere in the int check.
till
31st October 2008, 14:13
Then the problem is maybe in interface/lib/classes/tform.inc.php line 619:
$tmpval = intval($field_value);
The complete conversion of values and the generation of the sql for inserts and updates is in this library.
quentusrex
31st October 2008, 14:16
Haha, good catch. I was just testing different things in that file. I have removed the validators in mail_user.tform.php. And I tried to set it to a double. As a double it prevents the overflow. But we need to be able to have a FLOAT. But there isn't that option. It needs to be added....
quentusrex
31st October 2008, 14:23
I found the problem that overflows the INT. it's in the tform.inc.php file, but it's line 517. If you remove the intval there then the record won't overflow. It'll just be capped at just shy of the max. I'm going to submit this patch to prevent the overflow.
quentusrex
31st October 2008, 14:28
Another bug bites the dust. So, the current issue with the mail module is that the quota is capped at a max of 2GB per account. This can't be fixed until tforms.inc.php has the feature for FLOAT added to it.
till
31st October 2008, 15:46
But a float does not mean that its a integer or bigint, so to test if its a float is not sufficient here in my opinion.
quentusrex
31st October 2008, 15:57
Good point. Then I would agree it should be a BIGINT, rather than a FLOAT that gets added.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.