[exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src/transports appendfile.c exim/exim-test README runtest exim/exim-test/confs 5009 exim/exim-test/log 5009 exim/exim-test/scrip
ph10 2006/04/25 15:02:30 BST

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src/transports appendfile.c 
    exim-test            README runtest 
  Added files:
    exim-test/confs      5009 
    exim-test/log        5009 
    exim-test/scripts/5000-maildir 5009 
    exim-test/stdout     5009 
  Log:
  Fix problem with maildir delivery into a folder that is excluded from
  quota calculations.


  Revision  Changes    Path
  1.348     +8 -0      exim/exim-doc/doc-txt/ChangeLog
  1.17      +42 -21    exim/exim-src/src/transports/appendfile.c
  1.3       +3 -2      exim/exim-test/README
  1.1       +49 -0     exim/exim-test/confs/5009 (new)
  1.1       +9 -0      exim/exim-test/log/5009 (new)
  1.9       +2 -1      exim/exim-test/runtest
  1.1       +19 -0     exim/exim-test/scripts/5000-maildir/5009 (new)
  1.1       +11 -0     exim/exim-test/stdout/5009 (new)


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.347
  retrieving revision 1.348
  diff -u -r1.347 -r1.348
  --- ChangeLog    25 Apr 2006 10:44:57 -0000    1.347
  +++ ChangeLog    25 Apr 2006 14:02:29 -0000    1.348
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.347 2006/04/25 10:44:57 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.348 2006/04/25 14:02:29 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -41,6 +41,14 @@
         option (which defaults to 0600).


   PH/08 Applied small patch from the Sieve maintainer.
  +
  +PH/09 If maildir_quota_directory_regex was set to exclude (say) the .Trash
  +      folder from quota calculations, a direct delivery into this folder messed
  +      up the contents of the maildirsize file. This was because the regex was
  +      used only to exclude .Trash (or whatever) when the size of the mailbox
  +      was calculated. There was no check that a delivery was happening into an
  +      excluded directory. This bug has been fixed by ignoring all quota
  +      processing for deliveries into excluded directories.



Exim version 4.61

  Index: appendfile.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- appendfile.c    25 Apr 2006 10:06:30 -0000    1.16
  +++ appendfile.c    25 Apr 2006 14:02:30 -0000    1.17
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.16 2006/04/25 10:06:30 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.17 2006/04/25 14:02:30 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1226,6 +1226,7 @@
   uschar *path;
   struct utimbuf times;
   struct timeval msg_tv;
  +BOOL disable_quota = FALSE;
   BOOL isdirectory = FALSE;
   BOOL isfifo = FALSE;
   BOOL wait_for_tick = FALSE;
  @@ -2170,7 +2171,7 @@
       const uschar *error;
       int offset;


  -    /* Compile the regex if there is one */
  +    /* Compile the regex if there is one. */


       if (ob->quota_size_regex != NULL)
         {
  @@ -2183,11 +2184,8 @@
             ob->quota_size_regex);
           return FALSE;
           }
  -      else
  -        {
  -        DEBUG(D_transport) debug_printf("using regex for file sizes: %s\n",
  -          ob->quota_size_regex);
  -        }
  +      DEBUG(D_transport) debug_printf("using regex for file sizes: %s\n",
  +        ob->quota_size_regex);
         }


       /* Use an explicitly configured directory if set */
  @@ -2263,6 +2261,8 @@


       if (ob->maildir_dir_regex != NULL)
         {
  +      int check_path_len = Ustrlen(check_path);
  +
         dir_regex = pcre_compile(CS ob->maildir_dir_regex, PCRE_COPT,
           (const char **)&error, &offset, NULL);
         if (dir_regex == NULL)
  @@ -2272,11 +2272,27 @@
             ob->maildir_dir_regex);
           return FALSE;
           }
  -      else
  -        {
  -        DEBUG(D_transport)
  -          debug_printf("using regex for maildir directory selection: %s\n",
  -            ob->maildir_dir_regex);
  +
  +      DEBUG(D_transport)
  +        debug_printf("using regex for maildir directory selection: %s\n",
  +          ob->maildir_dir_regex);
  +
  +      /* Check to see if we are delivering into an ignored directory, that is,
  +      if the delivery path starts with the quota check path, and the rest
  +      of the deliver path matches the regex; if so, set a flag to disable quota
  +      checking and maildirsize updating. */
  +
  +      if (Ustrncmp(path, check_path, check_path_len) == 0)
  +        {
  +        uschar *s = path + check_path_len;
  +        while (*s == '/') s++;
  +        s = (*s == 0)? US "new" : string_sprintf("%s/new", s);
  +        if (pcre_exec(dir_regex, NULL, CS s, Ustrlen(s), 0, 0, NULL, 0) < 0)
  +          {
  +          disable_quota = TRUE;
  +          DEBUG(D_transport) debug_printf("delivery directory does not match "
  +            "maildir_quota_directory_regex: disabling quota\n");
  +          }
           }
         }


@@ -2287,6 +2303,7 @@

/* if (???? || ob->quota_value > 0) */

  +    if (!disable_quota)
         {
         off_t size;
         int filecount;
  @@ -2327,7 +2344,8 @@
     count. Note that ob->quota_filecount_value cannot be set without
     ob->quota_value being set. */


  -  if ((ob->quota_value > 0 || THRESHOLD_CHECK) &&
  +  if (!disable_quota &&
  +      (ob->quota_value > 0 || THRESHOLD_CHECK) &&
         (mailbox_size < 0 ||
           (mailbox_filecount < 0 && ob->quota_filecount_value > 0)))
       {
  @@ -2605,7 +2623,7 @@
   is for the mailbox already being over quota (i.e. the current message is not
   included in the check). */


  -if (ob->quota_value > 0)
  +if (!disable_quota && ob->quota_value > 0)
     {
     DEBUG(D_transport)
       {
  @@ -2775,22 +2793,25 @@
   message_size = transport_count;


/* If using a maildir++ quota file, add this message's size to it, and
-close the file descriptor. */
+close the file descriptor, except when the quota has been disabled because we
+are delivering into an uncounted folder. */

   #ifdef SUPPORT_MAILDIR
  -if (yield == OK && maildirsize_fd >= 0)
  -  maildir_record_length(maildirsize_fd, message_size);
  -
  -maildir_save_errno = errno;       /* Preserve errno while closing the file */
  -(void)close(maildirsize_fd);
  -errno = maildir_save_errno;
  +if (!disable_quota)
  +  {
  +  if (yield == OK && maildirsize_fd >= 0)
  +    maildir_record_length(maildirsize_fd, message_size);
  +  maildir_save_errno = errno;    /* Preserve errno while closing the file */
  +  (void)close(maildirsize_fd);
  +  errno = maildir_save_errno;
  +  }
   #endif  /* SUPPORT_MAILDIR */


/* If there is a quota warning threshold and we are have crossed it with this
message, set the SPECIAL_WARN flag in the address, to cause a warning message
to be sent. */

  -if (THRESHOLD_CHECK)
  +if (!disable_quota && THRESHOLD_CHECK)
     {
     off_t threshold = ob->quota_warn_threshold_value;
     if (ob->quota_warn_threshold_is_percent)


  Index: README
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/README,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- README    10 Feb 2006 16:29:20 -0000    1.2
  +++ README    25 Apr 2006 14:02:30 -0000    1.3
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-test/README,v 1.2 2006/02/10 16:29:20 ph10 Exp $
  +$Cambridge: exim/exim-test/README,v 1.3 2006/04/25 14:02:30 ph10 Exp $


EXPORTABLE EXIM TEST SUITE
--------------------------
@@ -705,8 +705,9 @@
different order.


-A number of standard file management commands are recognized. These are chmod,
-chown, ln, ls, du, mkdir, mkfifo, and touch. Some are run as root using "sudo".
+A number of standard file management commands are recognized. These are cat,
+chmod, chown, cp, ln, ls, du, mkdir, mkfifo, rm, rmdir, and touch. Some are run
+as root using "sudo".


Commands with input

  Index: runtest
  ===================================================================
  RCS file: /home/cvs/exim/exim-test/runtest,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- runtest    20 Apr 2006 15:34:25 -0000    1.8
  +++ runtest    25 Apr 2006 14:02:30 -0000    1.9
  @@ -1,6 +1,6 @@
   #! /usr/bin/perl -w


-# $Cambridge: exim/exim-test/runtest,v 1.8 2006/04/20 15:34:25 ph10 Exp $
+# $Cambridge: exim/exim-test/runtest,v 1.9 2006/04/25 14:02:30 ph10 Exp $

   ###############################################################################
   # This is the controlling script for the "new" test suite for Exim. It should #
  @@ -613,7 +613,7 @@
     s/\b\d+\.H\d+P\d+\b/dddddddddd.HddddddPddddd/;


     # Maildirsize data
  -  if (/^\d+S,\d+C\s*$/)
  +  while (/^\d+S,\d+C\s*$/)
       {
       print MUNGED;
       while (<IN>)
  @@ -623,6 +623,7 @@
         }
       last if !defined $_;
       }
  +  last if !defined $_;



     # ======== Output from the "fd" program about open descriptors ========


Index: 5009
====================================================================
# Exim test configuration 5009

SUB=

exim_path = EXIM_PATH
host_lookup_order = bydns
primary_hostname = myhost.test.ex
rfc1413_query_timeout = 0s
spool_directory = DIR/spool
log_file_path = DIR/spool/log/%slog
gecos_pattern = ""
gecos_name = CALLER_NAME


# ----- Main settings -----

qualify_domain = test.ex


# ----- Routers -----

begin routers

  r1:
    driver = accept
    transport = t1


# ----- Transports -----

begin transports

  t1:
    driver = appendfile
    directory = DIR/test-mail/SUB
    user = CALLER
    maildir_format
    maildir_use_size_file
    maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
    quota = 1M



# ----- Retry -----

begin retry

* * F,1d,1d


# End

Index: 5009
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaX-0005vi-00 => userx <userx@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaY-0005vi-00 => userx <userx@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
1999-03-02 09:44:33 10HmaZ-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx <userx@???> R=r1 T=t1
1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed

Index: 5009
====================================================================
# maildirsize with maildir_quota_directory_regex
#
exim -odi userx@???
Test message
****
cat DIR/test-mail/maildirsize >>test-stdout
mkdir test-mail/.Sub
touch test-mail/.Sub/maildirfolder
exim -DSUB=.Sub -odi userx@???
Test message
****
cat DIR/test-mail/maildirsize >>test-stdout
mkdir test-mail/.Trash
touch test-mail/.Trash/maildirfolder
exim -DSUB=.Trash -odi userx@???
Test message
****
cat DIR/test-mail/maildirsize >>test-stdout
no_message_check

Index: 5009
====================================================================
1048576S,0C
ddd d
ddd d
1048576S,0C
ddd d
ddd d
ddd d
1048576S,0C
ddd d
ddd d
ddd d