src.quota-ignore
changeset 6 d2183655483b
child 18 cacfba0189d0
equal deleted inserted replaced
5:399967a8bbf1 6:d2183655483b
       
     1 # HG changeset patch
       
     2 # Parent 717fd3d2296015e18687e4b3ecb259f7ded5e15f
       
     3 
       
     4 diff -r 717fd3d22960 src/transports/appendfile.c
       
     5 --- a/src/transports/appendfile.c	Sun Feb 13 14:05:44 2011 +0100
       
     6 +++ b/src/transports/appendfile.c	Tue Feb 15 11:18:53 2011 +0100
       
     7 @@ -31,6 +31,8 @@
       
     8  #define THRESHOLD_CHECK  (ob->quota_warn_threshold_value > 0 && \
       
     9    (!ob->quota_warn_threshold_is_percent || ob->quota_value > 0))
       
    10  
       
    11 +#define QUOTA_CHECK      (ob->quota_value > 0 && !ob->quota_no_check)
       
    12 +
       
    13  
       
    14  /* Options specific to the appendfile transport. They must be in alphabetic
       
    15  order (note that "_" comes before the lower case letters). Some of them are
       
    16 @@ -236,7 +238,9 @@
       
    17    FALSE,          /* mailstore_format */
       
    18    FALSE,          /* mbx_format */
       
    19    FALSE,          /* quota_warn_threshold_is_percent */
       
    20 -  TRUE            /* quota_is_inclusive */
       
    21 +  TRUE,           /* quota_is_inclusive */
       
    22 +  FALSE,          /* quota_no_check */
       
    23 +  FALSE           /* quota_filecount_no_check */
       
    24  };
       
    25  
       
    26  
       
    27 @@ -270,6 +274,7 @@
       
    28    (appendfile_transport_options_block *)(tblock->options_block);
       
    29  uschar *q = ob->quota;
       
    30  double default_value = 0.0;
       
    31 +int no_check = 0;
       
    32  int i;
       
    33  
       
    34  addrlist = addrlist;    /* Keep picky compilers happy */
       
    35 @@ -323,6 +328,15 @@
       
    36        rest++;
       
    37        }
       
    38  
       
    39 +
       
    40 +    /* For quota and quota_filecount there may be options
       
    41 +    appended. Currently only "no_check", so we can be lazy parsing it */
       
    42 +    if (i < 2 && Ustrstr(rest, "/no_check") == rest)
       
    43 +      {
       
    44 +	 no_check = 1;
       
    45 +	 rest += strlen("/no_check");
       
    46 +      }
       
    47 +
       
    48      while (isspace(*rest)) rest++;
       
    49  
       
    50      if (*rest != 0)
       
    51 @@ -340,12 +354,14 @@
       
    52      case 0:
       
    53      if (d >= 2.0*1024.0*1024.0*1024.0 && sizeof(off_t) <= 4) which = US"quota";
       
    54      ob->quota_value = (off_t)d;
       
    55 +    ob->quota_no_check = no_check;
       
    56      q = ob->quota_filecount;
       
    57      break;
       
    58  
       
    59      case 1:
       
    60      if (d >= 2.0*1024.0*1024.0*1024.0) which = US"quota_filecount";
       
    61      ob->quota_filecount_value = (int)d;
       
    62 +    ob->quota_filecount_no_check = no_check;
       
    63      q = ob->quota_warn_threshold;
       
    64      break;
       
    65  
       
    66 @@ -1382,10 +1398,12 @@
       
    67  DEBUG(D_transport)
       
    68    {
       
    69    debug_printf("appendfile: mode=%o notify_comsat=%d quota=" OFF_T_FMT
       
    70 +    "%s"
       
    71      " warning=" OFF_T_FMT "%s\n"
       
    72      "  %s=%s format=%s\n  message_prefix=%s\n  message_suffix=%s\n  "
       
    73      "maildir_use_size_file=%s\n",
       
    74      mode, ob->notify_comsat, ob->quota_value,
       
    75 +    ob->quota_no_check? " (no_check)" : ""
       
    76      ob->quota_warn_threshold_value,
       
    77      ob->quota_warn_threshold_is_percent? "%" : "",
       
    78      isdirectory? "directory" : "file",
       
    79 @@ -2274,7 +2292,7 @@
       
    80    create the file. When maildir support is not compiled,
       
    81    ob->maildir_use_size_file is always FALSE. */
       
    82  
       
    83 -  if (ob->quota_value > 0 || THRESHOLD_CHECK || ob->maildir_use_size_file)
       
    84 +  if (QUOTA_CHECK || THRESHOLD_CHECK || ob->maildir_use_size_file)
       
    85      {
       
    86      const uschar *error;
       
    87      int offset;
       
    88 diff -r 717fd3d22960 src/transports/appendfile.h
       
    89 --- a/src/transports/appendfile.h	Sun Feb 13 14:05:44 2011 +0100
       
    90 +++ b/src/transports/appendfile.h	Tue Feb 15 11:18:53 2011 +0100
       
    91 @@ -72,6 +72,8 @@
       
    92    BOOL  mbx_format;
       
    93    BOOL  quota_warn_threshold_is_percent;
       
    94    BOOL  quota_is_inclusive;
       
    95 +  BOOL  quota_no_check;
       
    96 +  BOOL  quota_filecount_no_check;
       
    97  } appendfile_transport_options_block;
       
    98  
       
    99  /* Restricted creation options */