src.quota-ignore
changeset 19 e86d83f17b1c
parent 18 cacfba0189d0
equal deleted inserted replaced
18:cacfba0189d0 19:e86d83f17b1c
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent 525ee4a1a637802b655f286de8cd9c737025ed37
     2 # Parent 525ee4a1a637802b655f286de8cd9c737025ed37
     3 
     3 
     4 diff -r 525ee4a1a637 doc/spec.txt
     4 diff -r 525ee4a1a637 doc/spec.txt
     5 --- a/doc/spec.txt	Fri Apr 01 14:06:59 2011 +0200
     5 --- a/doc/spec.txt	Fri Apr 01 14:06:59 2011 +0200
     6 +++ b/doc/spec.txt	Fri Apr 01 16:08:04 2011 +0200
     6 +++ b/doc/spec.txt	Fri Apr 01 16:33:35 2011 +0200
     7 @@ -18340,6 +18340,9 @@
     7 @@ -18340,6 +18340,9 @@
     8  large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
     8  large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
     9  be handled.
     9  be handled.
    10  
    10  
    11 +If there is "/no_check" appended, then all processing is done as usual, but the
    11 +If there is "/no_check" appended, then all processing is done as usual, but the
    24  +--------------------------------------------------------------+
    24  +--------------------------------------------------------------+
    25  |quota_is_inclusive|Use: appendfile|Type: boolean|Default: true|
    25  |quota_is_inclusive|Use: appendfile|Type: boolean|Default: true|
    26  +--------------------------------------------------------------+
    26  +--------------------------------------------------------------+
    27 diff -r 525ee4a1a637 src/transports/appendfile.c
    27 diff -r 525ee4a1a637 src/transports/appendfile.c
    28 --- a/src/transports/appendfile.c	Fri Apr 01 14:06:59 2011 +0200
    28 --- a/src/transports/appendfile.c	Fri Apr 01 14:06:59 2011 +0200
    29 +++ b/src/transports/appendfile.c	Fri Apr 01 16:08:04 2011 +0200
    29 +++ b/src/transports/appendfile.c	Fri Apr 01 16:33:35 2011 +0200
    30 @@ -237,7 +237,9 @@
    30 @@ -237,7 +237,9 @@
    31    FALSE,          /* mailstore_format */
    31    FALSE,          /* mailstore_format */
    32    FALSE,          /* mbx_format */
    32    FALSE,          /* mbx_format */
    33    FALSE,          /* quota_warn_threshold_is_percent */
    33    FALSE,          /* quota_warn_threshold_is_percent */
    34 -  TRUE            /* quota_is_inclusive */
    34 -  TRUE            /* quota_is_inclusive */
    95      mode, ob->notify_comsat, ob->quota_value,
    95      mode, ob->notify_comsat, ob->quota_value,
    96 +    ob->quota_no_check? " (no_check)" : "",
    96 +    ob->quota_no_check? " (no_check)" : "",
    97      ob->quota_warn_threshold_value,
    97      ob->quota_warn_threshold_value,
    98      ob->quota_warn_threshold_is_percent? "%" : "",
    98      ob->quota_warn_threshold_is_percent? "%" : "",
    99      isdirectory? "directory" : "file",
    99      isdirectory? "directory" : "file",
   100 @@ -2771,15 +2787,23 @@
   100 @@ -2773,18 +2789,31 @@
   101      debug_printf("  file count quota = %d count = %d\n",
       
   102        ob->quota_filecount_value, mailbox_filecount);
       
   103      }
   101      }
   104 -  if (mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
   102    if (mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
   105 +  DEBUG(D_transport) {
       
   106 +	if (ob->quota_no_check) 
       
   107 +		debug_printf("not checking quota (/no_check seen)\n");
       
   108 +	if (ob->quota_filecount_no_check) 
       
   109 +		debug_printf("not checking quota filecount (/no_check seen)\n");
       
   110 +  }
       
   111 +  if (!ob->quota_no_check 
       
   112 +      && mailbox_size + (ob->quota_is_inclusive? message_size:0) > ob->quota_value)
       
   113      {
   103      {
   114      DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
   104 -    DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
   115      yield = DEFER;
   105 -    yield = DEFER;
   116      errno = ERRNO_EXIMQUOTA;
   106 -    errno = ERRNO_EXIMQUOTA;
       
   107 +      DEBUG(D_transport) if (ob->quota_no_check) 
       
   108 +            debug_printf("mailbox quota exceeded but ignored\n");
       
   109 +
       
   110 +      if (!ob->quota_no_check) 
       
   111 +        {
       
   112 +            DEBUG(D_transport) debug_printf("mailbox quota exceeded\n");
       
   113 +            yield = DEFER;
       
   114 +            errno = ERRNO_EXIMQUOTA;
       
   115 +        }
       
   116 +
   117      }
   117      }
   118 -  else if (ob->quota_filecount_value > 0 &&
   118 -  else if (ob->quota_filecount_value > 0 &&
   119 -           mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
   119 -           mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
   120 -             ob->quota_filecount_value)
   120 -             ob->quota_filecount_value)
   121 +  else if (!ob->quota_filecount_no_check 
   121 +  else if (ob->quota_filecount_value > 0
   122 +           && ob->quota_filecount_value > 0
       
   123 +           && mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
   122 +           && mailbox_filecount + (ob->quota_is_inclusive ? 1:0) >
   124 +              ob->quota_filecount_value)
   123 +              ob->quota_filecount_value)
   125      {
   124      {
   126      DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
   125 -    DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
   127      yield = DEFER;
   126 -    yield = DEFER;
       
   127 -    errno = ERRNO_EXIMQUOTA;
       
   128 -    filecount_msg = US" filecount";
       
   129 +        DEBUG(D_transport) if (ob->quota_filecount_no_check)
       
   130 +                debug_printf("mailbox file count quota exceeded but ignored\n");
       
   131 +
       
   132 +        if(!ob->quota_filecount_no_check) 
       
   133 +          {
       
   134 +            DEBUG(D_transport) debug_printf("mailbox file count quota exceeded\n");
       
   135 +            yield = DEFER;
       
   136 +            errno = ERRNO_EXIMQUOTA;
       
   137 +            filecount_msg = US" filecount";
       
   138 +          }
       
   139      }
       
   140    }
       
   141  
   128 diff -r 525ee4a1a637 src/transports/appendfile.h
   142 diff -r 525ee4a1a637 src/transports/appendfile.h
   129 --- a/src/transports/appendfile.h	Fri Apr 01 14:06:59 2011 +0200
   143 --- a/src/transports/appendfile.h	Fri Apr 01 14:06:59 2011 +0200
   130 +++ b/src/transports/appendfile.h	Fri Apr 01 16:08:04 2011 +0200
   144 +++ b/src/transports/appendfile.h	Fri Apr 01 16:33:35 2011 +0200
   131 @@ -72,6 +72,8 @@
   145 @@ -72,6 +72,8 @@
   132    BOOL  mbx_format;
   146    BOOL  mbx_format;
   133    BOOL  quota_warn_threshold_is_percent;
   147    BOOL  quota_warn_threshold_is_percent;
   134    BOOL  quota_is_inclusive;
   148    BOOL  quota_is_inclusive;
   135 +  BOOL  quota_no_check;
   149 +  BOOL  quota_no_check;