src.quota-ignore
changeset 18 cacfba0189d0
parent 6 d2183655483b
child 19 e86d83f17b1c
--- a/src.quota-ignore	Tue Mar 08 11:11:21 2011 +0100
+++ b/src.quota-ignore	Fri Apr 01 16:08:28 2011 +0200
@@ -1,19 +1,33 @@
 # HG changeset patch
-# Parent 717fd3d2296015e18687e4b3ecb259f7ded5e15f
+# Parent 525ee4a1a637802b655f286de8cd9c737025ed37
 
-diff -r 717fd3d22960 src/transports/appendfile.c
---- a/src/transports/appendfile.c	Sun Feb 13 14:05:44 2011 +0100
-+++ b/src/transports/appendfile.c	Tue Feb 15 11:18:53 2011 +0100
-@@ -31,6 +31,8 @@
- #define THRESHOLD_CHECK  (ob->quota_warn_threshold_value > 0 && \
-   (!ob->quota_warn_threshold_is_percent || ob->quota_value > 0))
+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
+@@ -18340,6 +18340,9 @@
+ large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
+ be handled.
+ 
++If there is "/no_check" appended, then all processing is done as usual, but the
++over quota condition is not checked.
++
+ Note: A value of zero is interpreted as "no quota".
  
-+#define QUOTA_CHECK      (ob->quota_value > 0 && !ob->quota_no_check)
-+
+ The expansion happens while Exim is running as root, before it changes uid for
+@@ -18378,6 +18381,9 @@
+ failure causes delivery to be deferred. A value of zero is interpreted as "no
+ quota".
  
- /* Options specific to the appendfile transport. They must be in alphabetic
- order (note that "_" comes before the lower case letters). Some of them are
-@@ -236,7 +238,9 @@
++if there is "/no_check" appended, then all processing is done as usual, but
++the over quota condition is not checked.
++
+ +--------------------------------------------------------------+
+ |quota_is_inclusive|Use: appendfile|Type: boolean|Default: true|
+ +--------------------------------------------------------------+
+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
+@@ -237,7 +237,9 @@
    FALSE,          /* mailstore_format */
    FALSE,          /* mbx_format */
    FALSE,          /* quota_warn_threshold_is_percent */
@@ -23,16 +37,16 @@
 +  FALSE           /* quota_filecount_no_check */
  };
  
+ void hs12_lock(int fd, int type, const char* msg)
+@@ -312,6 +314,7 @@
+ for (i = 0; i < 5; i++)
+   {
+   double d;
++  int no_check = 0;
+   uschar *which = NULL;
  
-@@ -270,6 +274,7 @@
-   (appendfile_transport_options_block *)(tblock->options_block);
- uschar *q = ob->quota;
- double default_value = 0.0;
-+int no_check = 0;
- int i;
- 
- addrlist = addrlist;    /* Keep picky compilers happy */
-@@ -323,6 +328,15 @@
+   if (q == NULL) d = default_value; else
+@@ -348,12 +351,21 @@
        rest++;
        }
  
@@ -42,13 +56,20 @@
 +    if (i < 2 && Ustrstr(rest, "/no_check") == rest)
 +      {
 +	 no_check = 1;
-+	 rest += strlen("/no_check");
++	 rest += sizeof("/no_check") - 1;
 +      }
 +
      while (isspace(*rest)) rest++;
  
      if (*rest != 0)
-@@ -340,12 +354,14 @@
+       {
+       *errmsg = string_sprintf("Malformed value \"%s\" (expansion of \"%s\") "
+-        "in %s transport", s, q, tblock->name);
++        "in %s transport [%s]", s, q, tblock->name);
+       return FAIL;
+       }
+     }
+@@ -365,12 +377,14 @@
      case 0:
      if (d >= 2.0*1024.0*1024.0*1024.0 && sizeof(off_t) <= 4) which = US"quota";
      ob->quota_value = (off_t)d;
@@ -63,7 +84,7 @@
      q = ob->quota_warn_threshold;
      break;
  
-@@ -1382,10 +1398,12 @@
+@@ -1406,10 +1420,12 @@
  DEBUG(D_transport)
    {
    debug_printf("appendfile: mode=%o notify_comsat=%d quota=" OFF_T_FMT
@@ -72,22 +93,41 @@
      "  %s=%s format=%s\n  message_prefix=%s\n  message_suffix=%s\n  "
      "maildir_use_size_file=%s\n",
      mode, ob->notify_comsat, ob->quota_value,
-+    ob->quota_no_check? " (no_check)" : ""
++    ob->quota_no_check? " (no_check)" : "",
      ob->quota_warn_threshold_value,
      ob->quota_warn_threshold_is_percent? "%" : "",
      isdirectory? "directory" : "file",
-@@ -2274,7 +2292,7 @@
-   create the file. When maildir support is not compiled,
-   ob->maildir_use_size_file is always FALSE. */
- 
--  if (ob->quota_value > 0 || THRESHOLD_CHECK || ob->maildir_use_size_file)
-+  if (QUOTA_CHECK || THRESHOLD_CHECK || ob->maildir_use_size_file)
+@@ -2771,15 +2787,23 @@
+     debug_printf("  file count quota = %d count = %d\n",
+       ob->quota_filecount_value, mailbox_filecount);
+     }
+-  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)
      {
-     const uschar *error;
-     int offset;
-diff -r 717fd3d22960 src/transports/appendfile.h
---- a/src/transports/appendfile.h	Sun Feb 13 14:05:44 2011 +0100
-+++ b/src/transports/appendfile.h	Tue Feb 15 11:18:53 2011 +0100
+     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
++           && 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;
+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
 @@ -72,6 +72,8 @@
    BOOL  mbx_format;
    BOOL  quota_warn_threshold_is_percent;