started overquota patch, adjusted guards
authorHeiko Schlittermann (I24) <hs@schlittermann.de>
Fri, 01 Apr 2011 16:36:54 +0200
changeset 19 e86d83f17b1c
parent 18 cacfba0189d0
child 20 b0915cb51881
started overquota patch, adjusted guards
series
src.overquota
src.quota-ignore
--- a/series	Fri Apr 01 16:08:28 2011 +0200
+++ b/series	Fri Apr 01 16:36:54 2011 +0200
@@ -4,4 +4,5 @@
 src.maildir_use_size_file #+4.74
 src.fixed_ensure_maildirsize #+4.74
 src.lock_maildirsize #+4.74
-src.quota-ignore #+test
+src.quota-ignore #+4.74
+src.overquota #+testing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src.overquota	Fri Apr 01 16:36:54 2011 +0200
@@ -0,0 +1,34 @@
+# HG changeset patch
+# Parent 19657156fd0205d481cb4c2ceedd10fbed515dc8
+
+diff -r 19657156fd02 src/transports/appendfile.c
+--- a/src/transports/appendfile.c	Fri Apr 01 16:08:04 2011 +0200
++++ b/src/transports/appendfile.c	Fri Apr 01 16:21:46 2011 +0200
+@@ -104,6 +104,8 @@
+ #ifdef SUPPORT_MAILDIR
+   { "maildir_format",    opt_bool,
+       (void *)offsetof(appendfile_transport_options_block, maildir_format ) } ,
++  { "maildir_overquota_file",    opt_stringptr,
++      (void *)offsetof(appendfile_transport_options_block, maildir_overquota_file ) },
+   { "maildir_quota_directory_regex", opt_stringptr,
+       (void *)offsetof(appendfile_transport_options_block, maildir_dir_regex) },
+   { "maildir_retries",   opt_int,
+@@ -190,6 +192,7 @@
+   NULL,           /* mailbox_size_string */
+   NULL,           /* mailbox_filecount_string */
+   NULL,           /* expand_maildir_use_size_file */ 
++  NULL,           /* maildir_overquota_file */
+   US"^(?:cur|new|\\..*)$",  /* maildir_dir_regex */
+   NULL,           /* maildir_tag */
+   NULL,           /* maildirfolder_create_regex */
+diff -r 19657156fd02 src/transports/appendfile.h
+--- a/src/transports/appendfile.h	Fri Apr 01 16:08:04 2011 +0200
++++ b/src/transports/appendfile.h	Fri Apr 01 16:21:46 2011 +0200
+@@ -24,6 +24,7 @@
+   uschar *mailbox_size_string;
+   uschar *mailbox_filecount_string;
+   uschar *expand_maildir_use_size_file;
++  uschar *maildir_overquota_file;
+   uschar *maildir_dir_regex;
+   uschar *maildir_tag;
+   uschar *maildirfolder_create_regex;
--- a/src.quota-ignore	Fri Apr 01 16:08:28 2011 +0200
+++ b/src.quota-ignore	Fri Apr 01 16:36:54 2011 +0200
@@ -3,7 +3,7 @@
 
 diff -r 525ee4a1a637 doc/spec.txt
 --- a/doc/spec.txt	Fri Apr 01 14:06:59 2011 +0200
-+++ b/doc/spec.txt	Fri Apr 01 16:08:04 2011 +0200
++++ b/doc/spec.txt	Fri Apr 01 16:33:35 2011 +0200
 @@ -18340,6 +18340,9 @@
  large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
  be handled.
@@ -26,7 +26,7 @@
  +--------------------------------------------------------------+
 diff -r 525ee4a1a637 src/transports/appendfile.c
 --- a/src/transports/appendfile.c	Fri Apr 01 14:06:59 2011 +0200
-+++ b/src/transports/appendfile.c	Fri Apr 01 16:08:04 2011 +0200
++++ b/src/transports/appendfile.c	Fri Apr 01 16:33:35 2011 +0200
 @@ -237,7 +237,9 @@
    FALSE,          /* mailstore_format */
    FALSE,          /* mbx_format */
@@ -97,37 +97,51 @@
      ob->quota_warn_threshold_value,
      ob->quota_warn_threshold_is_percent? "%" : "",
      isdirectory? "directory" : "file",
-@@ -2771,15 +2787,23 @@
-     debug_printf("  file count quota = %d count = %d\n",
-       ob->quota_filecount_value, mailbox_filecount);
+@@ -2773,18 +2789,31 @@
      }
--  if (mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
-+  DEBUG(D_transport) {
-+	if (ob->quota_no_check) 
-+		debug_printf("not checking quota (/no_check seen)\n");
-+	if (ob->quota_filecount_no_check) 
-+		debug_printf("not checking quota filecount (/no_check seen)\n");
-+  }
-+  if (!ob->quota_no_check 
-+      && mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
+   if (mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
      {
-     DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
-     yield = DEFER;
-     errno = ERRNO_EXIMQUOTA;
+-    DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
+-    yield = DEFER;
+-    errno = ERRNO_EXIMQUOTA;
++      DEBUG(D_transport) if (ob->quota_no_check) 
++            debug_printf("mailbox quota exceeded but ignored\n");
++
++      if (!ob->quota_no_check) 
++        {
++            DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
++            yield = DEFER;
++            errno = ERRNO_EXIMQUOTA;
++        }
++
      }
 -  else if (ob->quota_filecount_value > 0 &&
 -           mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
 -             ob->quota_filecount_value)
-+  else if (!ob->quota_filecount_no_check 
-+           && ob->quota_filecount_value > 0
++  else if (ob->quota_filecount_value > 0
 +           && mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
 +              ob->quota_filecount_value)
      {
-     DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
-     yield = DEFER;
+-    DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
+-    yield = DEFER;
+-    errno = ERRNO_EXIMQUOTA;
+-    filecount_msg = US" filecount";
++        DEBUG(D_transport) if (ob->quota_filecount_no_check)
++                debug_printf("mailbox file count quota exceeded but ignored\n");
++
++        if(!ob->quota_filecount_no_check) 
++          {
++            DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
++            yield = DEFER;
++            errno = ERRNO_EXIMQUOTA;
++            filecount_msg = US" filecount";
++          }
+     }
+   }
+ 
 diff -r 525ee4a1a637 src/transports/appendfile.h
 --- a/src/transports/appendfile.h	Fri Apr 01 14:06:59 2011 +0200
-+++ b/src/transports/appendfile.h	Fri Apr 01 16:08:04 2011 +0200
++++ b/src/transports/appendfile.h	Fri Apr 01 16:33:35 2011 +0200
 @@ -72,6 +72,8 @@
    BOOL  mbx_format;
    BOOL  quota_warn_threshold_is_percent;