Bluehost.com Web Hosting $6.95

[courier-users] Quota warning code

This is a discussion on [courier-users] Quota warning code within the Courier-Imap forums, part of the Mail Servers and Related category; While troubleshooting a local problem, I had the opportunity to examine the quota warning code in courier/maildir/. I noticed ...


Go Back   Usenet Forums > Mail Servers and Related > Courier-Imap

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-03-2005
John Morrissey
 
Posts: n/a
Default [courier-users] Quota warning code

While troubleshooting a local problem, I had the opportunity to examine the
quota warning code in courier/maildir/.

I noticed that if the stat() on Maildir/quotawarn fails, the quota warning
is still delivered. Since everything else seems to fail fast, I've modified
the check to behave similarly if the stat() fails and errno != ENOENT.

Also, the check on open() wasn't catching failure, since open(2) returns -1
on failure, and !(-1) is false.

john


Index: maildirquota.c
================================================== =================
RCS file: /cvsroot/courier/libs/maildir/maildirquota.c,v
retrieving revision 1.26
diff -u -r1.26 maildirquota.c
--- maildirquota.c 12 Feb 2005 22:15:50 -0000 1.26
+++ maildirquota.c 2 Dec 2005 19:17:51 -0000
@@ -978,7 +978,7 @@

static void do_deliver_warning(const char *msgfile, const char *dir)
{
-int fdin, fd;
+int fdin, fd, ret;
FILE *fpout;
time_t t;
size_t l, msg_len;
@@ -1004,7 +1004,9 @@

strcat(strcpy(qname, dir), "/quotawarn");
time(&t);
- if (stat(qname, &sb) == 0 && ((sb.st_mtime + 86400) > t))
+ ret = stat(qname, &sb);
+ if ((ret == -1 && errno != ENOENT) ||
+ (ret == 0 && (sb.st_mtime + 86400) > t))
{
free(qname);
close(fdin);
@@ -1013,7 +1015,7 @@

fd = open(qname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
free(qname);
- if (!fd)
+ if (fd == -1)
{
close(fdin);
return;

john
--
John Morrissey _o /\ ---- __o
jwm@horde.net _-< \_ / \ ---- < \,
www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:13 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0