Re: [vchkpw] vdelivermail, user quotas and the maildirsize file

2004-12-04 Thread X-Istence
On Dec 3, 2004, at 7:24 PM, Tom Collins wrote:
I don't know.  I've only started to look into the mail quota code.
I may pull fresh code from the most recent Courier-IMAP (original 
source of most of the code) and make sure that I spend as little time 
with the file open as necessary.  I think that vdelivermail will open 
it for exclusive write access and then append the new size.

I have no idea how it will behave if multiple processes want to append 
to it at the same time.  It may be difficult, but I guess I could 
write a shell script that attempts to deliver two very large emails 
simultaneously.  I could also add an artificial delay in vdelivermail 
so it keeps the file open longer than necessary in order to force one 
process to wait for write access.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: 
http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/


How about locking the file from reading and writing until the writing 
task is complete, that way there should never be an inconsistent 
moment, unless off course two vdelivermails try to grab the file lock 
at the same time, and kernel both grants them (Happened to me on BSD 
4.2, was solved in a later version). So that should never happen.

If you make the time spent with the file as little as possible, then 
there should be no slowdown at all.

X-Istence


Re: [vchkpw] vdelivermail, user quotas and the maildirsize file

2004-12-03 Thread Dave Goodrich
[intentionaly top posted]
You are my new hero Mr. Collins.
If you are in or near central Indiana, my wife makes apple pie and 
vegetable soup that grown men will crawl through broken glass for, there 
are a few servings waiting for you.

Can't wait to give it a try.
DAve
Tom Collins wrote:
I've undertaken the task of cleaning up vdelivermail. I think I've fixed 
some problems where vdelivermail could exit without closing its 
connection to MySQL. I've also fixed sections that exited with the wrong 
exit code (causing qmail-local to assume mail was delivered when it 
wasn't, or vice-versa).

I'm now digging into quotas. Oh, the joy.
I found one immediate problem. vdelivermail was adding an email's size 
to the maildirsize file before it was successfully delivered. If there 
was any sort of error, the maildirsize file would end up out of whack.

Additionally, the size of the extra headers (Return-Path and 
Delivered-To) weren't included in the values written. This causes a 
problem because POP/IMAP will enter a negative value for the size of the 
entire message (including those headers). I could be wrong on that -- 
the POP/IMAP server might use the S= part of the filename which was 
also written incorrectly by the old vdelivermail.

Anyway, I've made some good progress, and now it only updates 
maildirsize if the message was successfully written. It will update the 
maildirsize of ANY Maildir that it delivers to, including valiases, the 
catchall, and save-a-copy on .qmail files that forward to another location.

The only missing piece is actually checking for overquota situations on 
anything but a standard user without a .qmail file. I also don't handle 
the situation where the maildirsize file does not exist. Realistically, 
I can only re-create it for the Maildir that belongs to the current 
user. Other than reading the maildirsize file, there's no easy way to 
look up a quota based on a Maildir directory path.

After all of the time I've put into it, there's no way I'm going to 
touch domain quotas...

If anyone knows of any other vdelivermail oddities that should be fixed, 
please let me know and I'll try to address them in this upcoming release.

--
Tom Collins - [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/ Vpopmail: http://vpopmail.sf.net/
Info on the *Sniffter* hand-held Network Tester: http://sniffter.com/

No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.289 / Virus Database: 265.4.4 - Release Date: 11/30/2004
--
Systems Administrator
http://www.tls.net
Get rid of Unwanted Emails...get TLS Spam Blocker!


RE: [vchkpw] vdelivermail, user quotas and the maildirsize file

2004-12-03 Thread shadowplay.net
Title: Message




does 
this change take into account the ablity for multi processing on the maildirsize 

and 2 
vdeliverers attempting to add to the mailbox at near simultaneous time... 

think 
multiple mailservers with a nfs connection to the maildirectories... 


ie at 
this time if i accept a mail its added to quota.. 
then 
while im writing my mail in a second vdeliver needs to 
write,
looksin quota, reports over,and we bounce.. 


under 
the new structure.. will this occur or will BOTH files get 

written into the mail directory...




  
  -Original Message-From: Tom Collins 
  [mailto:[EMAIL PROTECTED] 
  I found one immediate 
  problem. vdelivermail was adding an email's size to the maildirsize file 
  before it was successfully delivered. If there was any sort of error, the 
  maildirsize file would end up out of whack.
  


Re: [vchkpw] vdelivermail, user quotas and the maildirsize file

2004-12-03 Thread Tom Collins
On Dec 3, 2004, at 3:01 PM, shadowplay.net wrote:
does this change take into account the ablity for multi processing on 
the maildirsize
 and 2 vdeliverers attempting to add to the mailbox at near 
simultaneous time...
 think multiple mailservers with a nfs connection to the 
maildirectories...
  
ie at this time if i accept a mail its added to quota..
 then while im writing my mail in a second vdeliver needs to write,
looks in quota, reports over, and we bounce..
  
under the new structure.. will this occur or will BOTH files get
 written into the mail directory... 
I don't know.  I've only started to look into the mail quota code.
I may pull fresh code from the most recent Courier-IMAP (original 
source of most of the code) and make sure that I spend as little time 
with the file open as necessary.  I think that vdelivermail will open 
it for exclusive write access and then append the new size.

I have no idea how it will behave if multiple processes want to append 
to it at the same time.  It may be difficult, but I guess I could write 
a shell script that attempts to deliver two very large emails 
simultaneously.  I could also add an artificial delay in vdelivermail 
so it keeps the file open longer than necessary in order to force one 
process to wait for write access.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/


[vchkpw] vdelivermail, user quotas and the maildirsize file

2004-12-02 Thread Tom Collins
I've undertaken the task of cleaning up vdelivermail.  I think I've fixed some problems where vdelivermail could exit without closing its connection to MySQL.  I've also fixed sections that exited with the wrong exit code (causing qmail-local to assume mail was delivered when it wasn't, or vice-versa).

I'm now digging into quotas.  Oh, the joy.

I found one immediate problem.  vdelivermail was adding an email's size to the maildirsize file before it was successfully delivered.  If there was any sort of error, the maildirsize file would end up out of whack.

Additionally, the size of the extra headers (Return-Path and Delivered-To) weren't included in the values written.  This causes a problem because POP/IMAP will enter a negative value for the size of the entire message (including those headers).  I could be wrong on that -- the POP/IMAP server might use the S= part of the filename which was also written incorrectly by the old vdelivermail.

Anyway, I've made some good progress, and now it only updates maildirsize if the message was successfully written.  It will update the maildirsize of ANY Maildir that it delivers to, including valiases, the catchall, and save-a-copy on .qmail files that forward to another location.

The only missing piece is actually checking for overquota situations on anything but a standard user without a .qmail file.  I also don't handle the situation where the maildirsize file does not exist.  Realistically, I can only re-create it for the Maildir that belongs to the current user.  Other than reading the maildirsize file, there's no easy way to look up a quota based on a Maildir directory path.

After all of the time I've put into it, there's no way I'm going to touch domain quotas...

If anyone knows of any other vdelivermail oddities that should be fixed, please let me know and I'll try to address them in this upcoming release.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/ 
Info on the Sniffter hand-held Network Tester: http://sniffter.com/