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

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: exim-cvs
Tárgy: [exim-cvs] cvs commit: exim/exim-doc/doc-txt ChangeLog exim/exim-src/src deliver.c expand.c queue.c rda.c string.c tls-gnu.c exim/exim-src/src/lookups cdb.c exim/exim-src/src/transports appendfile
ph10 2005/06/07 16:20:56 BST

  Modified files:
    exim-doc/doc-txt     ChangeLog 
    exim-src/src         deliver.c expand.c queue.c rda.c string.c 
                         tls-gnu.c 
    exim-src/src/lookups cdb.c 
    exim-src/src/transports appendfile.c appendfile.h autoreply.c 
                            tf_maildir.c tf_maildir.h 
  Log:
  Upgrade appendfile so that it is capable of handling quotas that are
  greater than 2G.


  Revision  Changes    Path
  1.150     +8 -0      exim/exim-doc/doc-txt/ChangeLog
  1.16      +4 -7      exim/exim-src/src/deliver.c
  1.24      +3 -3      exim/exim-src/src/expand.c
  1.2       +1 -1      exim/exim-src/src/lookups/cdb.c
  1.6       +2 -4      exim/exim-src/src/queue.c
  1.6       +1 -7      exim/exim-src/src/rda.c
  1.4       +3 -3      exim/exim-src/src/string.c
  1.7       +2 -2      exim/exim-src/src/tls-gnu.c
  1.7       +48 -37    exim/exim-src/src/transports/appendfile.c
  1.3       +4 -4      exim/exim-src/src/transports/appendfile.h
  1.3       +3 -3      exim/exim-src/src/transports/autoreply.c
  1.5       +18 -18    exim/exim-src/src/transports/tf_maildir.c
  1.3       +7 -7      exim/exim-src/src/transports/tf_maildir.h


  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- ChangeLog    7 Jun 2005 10:41:26 -0000    1.149
  +++ ChangeLog    7 Jun 2005 15:20:55 -0000    1.150
  @@ -1,4 +1,4 @@
  -$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.149 2005/06/07 10:41:26 ph10 Exp $
  +$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.150 2005/06/07 15:20:55 ph10 Exp $


   Change log file for Exim from version 4.21
   -------------------------------------------
  @@ -95,6 +95,14 @@
         def:variable_name" (after optional whitespace) was not being diagnosed.
         An expansion such as ${if def:sender_ident:{xxx}{yyy}} in which an
         accidental colon was present, for example, could give incorrect results.
  +
  +PH/10 Tidied the code in a number of places where the st_size field of a stat()
  +      result is used (not including appendfile, where other changes are about
  +      to be made).
  +
  +PH/11 Upgraded appendfile so that quotas larger than 2G are now supported.
  +      This involved changing a lot of size variables from int to off_t. It
  +      should work with maildirs and everything.



Exim version 4.51

  Index: deliver.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/deliver.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- deliver.c    24 May 2005 08:15:02 -0000    1.15
  +++ deliver.c    7 Jun 2005 15:20:56 -0000    1.16
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/deliver.c,v 1.15 2005/05/24 08:15:02 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/deliver.c,v 1.16 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -4482,11 +4482,8 @@
       sprintf(CS big_buffer, "%s/input/%s/%s", spool_directory, message_subdir,
         spoolname);
       if (Ustat(big_buffer, &statbuf) == 0)
  -      {
  -      int size = statbuf.st_size;   /* Because might be a long */
  -      log_write(0, LOG_MAIN, "Format error in spool file %s: size=%d",
  -        spoolname, size);
  -      }
  +      log_write(0, LOG_MAIN, "Format error in spool file %s: size=%.30g",
  +        spoolname, (double)statbuf.st_size);
       else log_write(0, LOG_MAIN, "Format error in spool file %s", spoolname);
       }
     else
  @@ -6343,8 +6340,8 @@
               if (emf_text != NULL) fprintf(f, "%s", CS emf_text); else
                 {
                 fprintf(f,
  -"------ The body of the message is %d characters long; only the first\n"
  -"------ %d or so are included here.\n", (int)statbuf.st_size, max);
  +"------ The body of the message is %.30g characters long; only the first\n"
  +"------ %d or so are included here.\n", (double)statbuf.st_size, max);
                 }
               }
             }


  Index: expand.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/expand.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- expand.c    7 Jun 2005 10:41:27 -0000    1.23
  +++ expand.c    7 Jun 2005 15:20:56 -0000    1.24
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/expand.c,v 1.23 2005/06/07 10:41:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/expand.c,v 1.24 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1364,7 +1364,7 @@
       if (*ss == NULL && deliver_datafile >= 0)  /* Read body when needed */
         {
         uschar *body;
  -      int start_offset = SPOOL_DATA_START_OFFSET;
  +      off_t start_offset = SPOOL_DATA_START_OFFSET;
         int len = message_body_visible;
         if (len > message_size) len = message_size;
         *ss = body = store_malloc(len+1);
  @@ -4540,10 +4540,10 @@


           smode[10] = 0;
           s = string_sprintf("mode=%04lo smode=%s inode=%ld device=%ld links=%ld "
  -          "uid=%ld gid=%ld size=%ld atime=%ld mtime=%ld ctime=%ld",
  +          "uid=%ld gid=%ld size=%.30g atime=%ld mtime=%ld ctime=%ld",
             (long)(st.st_mode & 077777), smode, (long)st.st_ino,
             (long)st.st_dev, (long)st.st_nlink, (long)st.st_uid,
  -          (long)st.st_gid, (long)st.st_size, (long)st.st_atime,
  +          (long)st.st_gid, (double)st.st_size, (long)st.st_atime,
             (long)st.st_mtime, (long)st.st_ctime);
           yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
           continue;


  Index: queue.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/queue.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- queue.c    17 Feb 2005 11:58:26 -0000    1.5
  +++ queue.c    7 Jun 2005 15:20:56 -0000    1.6
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/queue.c,v 1.5 2005/02/17 11:58:26 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/queue.c,v 1.6 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -895,10 +895,8 @@
         sprintf(CS big_buffer, "%s/input/%s/%s", spool_directory, message_subdir,
           f->text);
         if (Ustat(big_buffer, &statbuf) == 0)
  -        {
  -        int size = statbuf.st_size;    /* Because might be a long */
  -        printf("*** spool format error: size=%d ***", size);
  -        }
  +        printf("*** spool format error: size=%.30g ***",
  +          (double)statbuf.st_size);
         else printf("*** spool format error ***");
         }
       else printf("*** spool read error: %s ***", strerror(save_errno));


  Index: rda.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/rda.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- rda.c    6 Apr 2005 14:40:24 -0000    1.5
  +++ rda.c    7 Jun 2005 15:20:56 -0000    1.6
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/rda.c,v 1.5 2005/04/06 14:40:24 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/rda.c,v 1.6 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -299,14 +299,8 @@
     }
   filebuf[statbuf.st_size] = 0;


-/* Don't pass statbuf.st_size directly to debug_printf. On some systems it
-is a long, which may not be the same as an int. */
-
DEBUG(D_route)
- {
- int size = (int)statbuf.st_size;
- debug_printf("%d bytes read from %s\n", size, filename);
- }
+ debug_printf("%.30g bytes read from %s\n", (double)statbuf.st_size, filename);

fclose(fwd);
return filebuf;

  Index: string.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/string.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- string.c    23 May 2005 16:58:56 -0000    1.3
  +++ string.c    7 Jun 2005 15:20:56 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/string.c,v 1.3 2005/05/23 16:58:56 fanf2 Exp $ */
  +/* $Cambridge: exim/exim-src/src/string.c,v 1.4 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -944,9 +944,9 @@
   as a va_list item.


The formats are the usual printf() ones, with some omissions (never used) and
-two additions for strings: %S forces lower case, %#s or %#S prints nothing for
-a NULL string. Without the # "NULL" is printed (useful in debugging). There is
-also the addition of %D, which inserts the date in the form used for
+two additions for strings: %S forces lower case, and %#s or %#S prints nothing
+for a NULL string. Without the # "NULL" is printed (useful in debugging). There
+is also the addition of %D, which inserts the date in the form used for
datestamped log files.

Arguments:

  Index: tls-gnu.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/tls-gnu.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- tls-gnu.c    8 Mar 2005 11:38:21 -0000    1.6
  +++ tls-gnu.c    7 Jun 2005 15:20:56 -0000    1.7
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/tls-gnu.c,v 1.6 2005/03/08 11:38:21 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/tls-gnu.c,v 1.7 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -499,8 +499,8 @@
       return DEFER;
       }


  -  DEBUG(D_tls) debug_printf("verify certificates = %s size=%d\n",
  -    cas_expanded, (int)statbuf.st_size);
  +  DEBUG(D_tls) debug_printf("verify certificates = %s size=%.30g\n",
  +    cas_expanded, (double)statbuf.st_size);


     /* If the cert file is empty, there's no point in loading the CRL file. */



  Index: cdb.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/lookups/cdb.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cdb.c    7 Oct 2004 13:10:01 -0000    1.1
  +++ cdb.c    7 Jun 2005 15:20:56 -0000    1.2
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/lookups/cdb.c,v 1.1 2004/10/07 13:10:01 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/lookups/cdb.c,v 1.2 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -167,7 +167,7 @@
       if (statbuf.st_size < CDB_HASH_TABLE) {
         int save_errno = errno;
         *errmsg = string_open_failed(errno,
  -                                  "%s to short for cdb lookup",
  +                                  "%s too short for cdb lookup",
                                     filename);
         errno = save_errno;
         return NULL;


  Index: appendfile.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- appendfile.c    27 Apr 2005 10:06:00 -0000    1.6
  +++ appendfile.c    7 Jun 2005 15:20:56 -0000    1.7
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.6 2005/04/27 10:06:00 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.7 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -189,11 +189,11 @@
     NULL,           /* check_string (default changed for non-bsmtp file)*/
     NULL,           /* escape_string (ditto) */
     NULL,           /* file_format */
  +  0,              /* quota_value */
  +  0,              /* quota_warn_threshold_value */
     -1,             /* mailbox_size_value */
     -1,             /* mailbox_filecount_value */
  -  0,              /* quota_value */
     0,              /* quota_filecount_value */
  -  0,              /* quota_warn_threshold_value */
     APPENDFILE_MODE,           /* mode */
     APPENDFILE_DIRECTORY_MODE, /* dirmode */
     APPENDFILE_LOCKFILE_MODE,  /* lockfile_mode */
  @@ -259,8 +259,7 @@
   appendfile_transport_options_block *ob =
     (appendfile_transport_options_block *)(tblock->options_block);
   uschar *q = ob->quota;
  -int *v = &(ob->quota_value);
  -int default_value = 0;
  +double default_value = 0.0;
   int i;


   addrlist = addrlist;    /* Keep picky compilers happy */
  @@ -271,9 +270,10 @@


   for (i = 0; i < 5; i++)
     {
  -  if (q == NULL) *v = default_value; else
  +  double d;
  +
  +  if (q == NULL) d = default_value; else
       {
  -    double d;
       uschar *rest;
       uschar *s = expand_string(q);


  @@ -314,31 +314,33 @@
           "in %s transport", s, q, tblock->name);
         return FAIL;
         }
  -
  -    *v = (int)d;
       }


     switch (i)
       {
       case 0:
  +    ob->quota_value = (off_t)d;
       q = ob->quota_filecount;
  -    v = &(ob->quota_filecount_value);
       break;


       case 1:
  +    ob->quota_filecount_value = (int)d;
       q = ob->quota_warn_threshold;
  -    v = &(ob->quota_warn_threshold_value);
       break;


       case 2:
  +    ob->quota_warn_threshold_value = (off_t)d;
       q = ob->mailbox_size_string;
  -    v = &(ob->mailbox_size_value);
  -    default_value = -1;
  +    default_value = -1.0;
       break;


       case 3:
  +    ob->mailbox_size_value = (off_t)d;
       q = ob->mailbox_filecount_string;
  -    v = &(ob->mailbox_filecount_value);
  +    break;
  +
  +    case 4:
  +    ob->mailbox_filecount_value = (int)d;
       break;
       }
     }
  @@ -548,7 +550,7 @@
   */


static void
-notify_comsat(uschar *user, int offset)
+notify_comsat(uschar *user, off_t offset)
{
struct servent *sp;
host_item host;
@@ -557,7 +559,7 @@

DEBUG(D_transport) debug_printf("notify_comsat called\n");

-sprintf(CS buffer, "%.200s@%d\n", user, offset);
+sprintf(CS buffer, "%.200s@%.30g\n", user, (double)offset);

   if ((sp = getservbyname("biff", "udp")) == NULL)
     {
  @@ -705,11 +707,11 @@
                   zero if the directory cannot be opened
   */


  -int
  +off_t
   check_dir_size(uschar *dirname, int *countptr, const pcre *regex)
   {
   DIR *dir;
  -int sum = 0;
  +off_t sum = 0;
   int count = *countptr;
   struct dirent *ent;
   struct stat statbuf;
  @@ -734,12 +736,13 @@
       if (pcre_exec(regex, NULL, CS name, Ustrlen(name), 0, 0, ovector,6) >= 2)
         {
         uschar *endptr;
  -      int size = Ustrtol(name + ovector[2], &endptr, 10);
  +      off_t size = (off_t)Ustrtod(name + ovector[2], &endptr);
         if (endptr == name + ovector[3])
           {
           sum += size;
           DEBUG(D_transport)
  -          debug_printf("check_dir_size: size from %s is %d\n", name, size);
  +          debug_printf("check_dir_size: size from %s is %.30g\n", name,
  +            (double)size);
           continue;
           }
         }
  @@ -773,7 +776,9 @@


   closedir(dir);
   DEBUG(D_transport)
  -  debug_printf("check_dir_size: dir=%s sum=%d count=%d\n", dirname, sum, count);
  +  debug_printf("check_dir_size: dir=%s sum=%.30g count=%d\n", dirname,
  +    (double)sum, count);
  +
   *countptr = count;
   return sum;
   }
  @@ -875,9 +880,10 @@
   #define MBX_NUSERFLAGS           30


static int
-copy_mbx_message(int to_fd, int from_fd, int saved_size)
+copy_mbx_message(int to_fd, int from_fd, off_t saved_size)
{
-int used, size;
+int used;
+off_t size;
struct stat statbuf;

/* If the current mailbox size is zero, write a header block */
@@ -903,8 +909,8 @@
if (fstat(from_fd, &statbuf) < 0) return DEFER;
size = statbuf.st_size;

-sprintf (CS deliver_out_buffer, "%s,%lu;%08lx%04x-%08x\015\012",
- tod_stamp(tod_mbx), (long unsigned int)size, 0L, 0, 0);
+sprintf (CS deliver_out_buffer, "%s,%.30g;%08lx%04x-%08x\015\012",
+ tod_stamp(tod_mbx), (double)size, 0L, 0, 0);
used = Ustrlen(deliver_out_buffer);

/* Rewind the temporary file, and copy it over in chunks. */
@@ -1206,8 +1212,8 @@
gid_t gid = getegid();
int mbformat;
int mode = (addr->mode > 0)? addr->mode : ob->mode;
-int saved_size = -1;
-int mailbox_size = ob->mailbox_size_value;
+off_t saved_size = -1;
+off_t mailbox_size = ob->mailbox_size_value;
int mailbox_filecount = ob->mailbox_filecount_value;
int hd = -1;
int fd = -1;
@@ -1336,10 +1342,12 @@

   DEBUG(D_transport)
     {
  -  debug_printf("appendfile: mode=%o notify_comsat=%d quota=%d warning=%d%s\n"
  +  debug_printf("appendfile: mode=%o notify_comsat=%d quota=%.30g "
  +    "warning=%.30g%s\n"
       "  %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_warn_threshold_value,
  +    mode, ob->notify_comsat, (double)ob->quota_value,
  +    (double)ob->quota_warn_threshold_value,
       ob->quota_warn_threshold_is_percent? "%" : "",
       isdirectory? "directory" : "file",
       path, mailbox_formats[mbformat],
  @@ -2254,7 +2262,8 @@
   /*  if (???? || ob->quota_value > 0) */


         {
  -      int size, filecount;
  +      off_t size;
  +      int filecount;


         maildirsize_fd = maildir_ensure_sizefile(check_path, ob, regex, dir_regex,
           &size, &filecount);
  @@ -2295,7 +2304,7 @@
     if ((mailbox_size < 0 || mailbox_filecount < 0) &&
         (ob->quota_value > 0 || THRESHOLD_CHECK))
       {
  -    int size;
  +    off_t size;
       int filecount = 0;
       DEBUG(D_transport)
         debug_printf("quota checks on directory %s\n", check_path);
  @@ -2573,9 +2582,9 @@
     {
     DEBUG(D_transport)
       {
  -    debug_printf("Exim quota = %d old size = %d this message = %d "
  -      "(%sincluded)\n", ob->quota_value, mailbox_size, message_size,
  -      ob->quota_is_inclusive? "" : "not ");
  +    debug_printf("Exim quota = %.30g old size = %.30g this message = %d "
  +      "(%sincluded)\n", (double)ob->quota_value, (double)mailbox_size,
  +      message_size, ob->quota_is_inclusive? "" : "not ");
       debug_printf("  file count quota = %d count = %d\n",
         ob->quota_filecount_value, mailbox_filecount);
       }
  @@ -2755,12 +2764,14 @@


   if (THRESHOLD_CHECK)
     {
  -  int threshold = ob->quota_warn_threshold_value;
  +  off_t threshold = ob->quota_warn_threshold_value;
     if (ob->quota_warn_threshold_is_percent)
  -    threshold = (int)(((double)ob->quota_value * threshold) / 100);
  +    threshold = (off_t)(((double)ob->quota_value * threshold) / 100);
     DEBUG(D_transport)
  -    debug_printf("quota = %d threshold = %d old size = %d message size = %d\n",
  -      ob->quota_value, threshold, mailbox_size, message_size);
  +    debug_printf("quota = %.30g threshold = %.30g old size = %.30g "
  +      "message size = %d\n",
  +      (double)ob->quota_value, (double)threshold, (double)mailbox_size,
  +      message_size);
     if (mailbox_size <= threshold && mailbox_size + message_size > threshold)
       addr->special_action = SPECIAL_WARN;



  Index: appendfile.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- appendfile.h    4 Jan 2005 10:00:45 -0000    1.2
  +++ appendfile.h    7 Jun 2005 15:20:56 -0000    1.3
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/appendfile.h,v 1.2 2005/01/04 10:00:45 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/appendfile.h,v 1.3 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -30,11 +30,11 @@
     uschar *check_string;
     uschar *escape_string;
     uschar *file_format;
  -  int   mailbox_size_value;
  +  off_t quota_value;
  +  off_t quota_warn_threshold_value;
  +  off_t mailbox_size_value;
     int   mailbox_filecount_value;
  -  int   quota_value;
     int   quota_filecount_value;
  -  int   quota_warn_threshold_value;
     int   mode;
     int   dirmode;
     int   lockfile_mode;
  @@ -92,6 +92,6 @@


/* Function that is shared with tf_maildir.c */

-extern int check_dir_size(uschar *, int *, const pcre *);
+extern off_t check_dir_size(uschar *, int *, const pcre *);

/* End of transports/appendfile.h */

  Index: autoreply.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/autoreply.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- autoreply.c    4 Jan 2005 10:00:45 -0000    1.2
  +++ autoreply.c    7 Jun 2005 15:20:56 -0000    1.3
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/autoreply.c,v 1.2 2005/01/04 10:00:45 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/autoreply.c,v 1.3 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -641,11 +641,11 @@
         DELIVER_IN_BUFFER_SIZE;
       if (fstat(deliver_datafile, &statbuf) == 0 && statbuf.st_size > max)
         {
  -      int size = statbuf.st_size;  /* Because might be a long */
         fprintf(f, "\n"
   "------ This is a copy of the message, including all the headers.\n"
  -"------ The body of the message is %d characters long; only the first\n"
  -"------ %d or so are included here.\n\n", size, (max/1000)*1000);
  +"------ The body of the message is %.30g characters long; only the first\n"
  +"------ %d or so are included here.\n\n", (double)statbuf.st_size,
  +        (max/1000)*1000);
         }
       else fprintf(f, "\n"
   "------ This is a copy of the message, including all the headers. ------\n\n");


  Index: tf_maildir.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/tf_maildir.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tf_maildir.c    17 Feb 2005 11:58:27 -0000    1.4
  +++ tf_maildir.c    7 Jun 2005 15:20:56 -0000    1.5
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/tf_maildir.c,v 1.4 2005/02/17 11:58:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/tf_maildir.c,v 1.5 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -198,12 +198,12 @@
   Returns:      the sum of the sizes of the messages
   */


  -int
  +off_t
   maildir_compute_size(uschar *path, int *filecount, time_t *latest,
     const pcre *regex, const pcre *dir_regex, BOOL timestamp_only)
   {
   DIR *dir;
  -int sum = 0;
  +off_t sum = 0;
   struct dirent *ent;
   struct stat statbuf;


  @@ -282,8 +282,8 @@
       debug_printf("maildir_compute_size (timestamp_only): %ld\n",
       (long int) *latest);
     else
  -    debug_printf("maildir_compute_size: path=%s\n  sum=%d filecount=%d "
  -      "timestamp=%ld\n", path, sum, *filecount, (long int) *latest);
  +    debug_printf("maildir_compute_size: path=%s\n  sum=%.30g filecount=%d "
  +      "timestamp=%ld\n", path, (double)sum, *filecount, (long int) *latest);
     }
   return sum;
   }
  @@ -320,15 +320,15 @@


   int
   maildir_ensure_sizefile(uschar *path, appendfile_transport_options_block *ob,
  -  const pcre *regex, const pcre *dir_regex, int *returned_size,
  +  const pcre *regex, const pcre *dir_regex, off_t *returned_size,
     int *returned_filecount)
   {
   int count, fd;
  -int cached_quota = 0;
  +off_t cached_quota = 0;
   int cached_quota_filecount = 0;
  -int size = 0;
   int filecount = 0;
   int linecount = 0;
  +off_t size = 0;
   uschar *filename;
   uschar buffer[MAX_FILE_SIZE];
   uschar *ptr = buffer;
  @@ -369,14 +369,14 @@


   for (;;)
     {
  -  long int n = Ustrtol(ptr, &endptr, 10);
  +  off_t n = (off_t)Ustrtod(ptr, &endptr);


     /* Only two data items are currently defined; ignore any others that
     may be present. The spec is for a number followed by a letter. Anything
     else we reject and recalculate. */


     if (*endptr == 'S') cached_quota = n;
  -    else if (*endptr == 'C') cached_quota_filecount = n;
  +    else if (*endptr == 'C') cached_quota_filecount = (int)n;
     if (!isalpha(*endptr++))
       {
       DEBUG(D_transport)
  @@ -404,9 +404,9 @@
     {
     DEBUG(D_transport)
       debug_printf("cached quota is out of date: recalculating\n"
  -      "  quota=%d cached_quota=%d filecount_quota=%d "
  -      "cached_quota_filecount=%d\n", ob->quota_value, cached_quota,
  -      ob->quota_filecount_value, cached_quota_filecount);
  +      "  quota=%.30g cached_quota=%.30g filecount_quota=%d "
  +      "cached_quota_filecount=%d\n", (double)ob->quota_value,
  +      (double)cached_quota, ob->quota_filecount_value, cached_quota_filecount);
     goto RECALCULATE;
     }


  @@ -421,7 +421,7 @@
     if (*endptr == 0) break;
     linecount++;
     ptr = endptr;
  -  size += Ustrtol(ptr, &endptr, 10);
  +  size += (off_t)Ustrtod(ptr, &endptr);
     if (*endptr != ' ') break;
     ptr = endptr + 1;
     filecount += Ustrtol(ptr, &endptr, 10);
  @@ -439,7 +439,7 @@
     if (size < 0 || filecount < 0)
       {
       DEBUG(D_transport) debug_printf("negative value in maildirsize "
  -      "(size=%d count=%d): recalculating\n", size, filecount);
  +      "(size=%.30g count=%d): recalculating\n", (double)size, filecount);
       goto RECALCULATE;
       }


  @@ -510,8 +510,8 @@
     fd = Uopen(tempname, O_RDWR|O_CREAT|O_EXCL, 0600);
     if (fd >= 0)
       {
  -    (void)sprintf(CS buffer, "%dS,%dC\n%d %d\n", ob->quota_value,
  -      ob->quota_filecount_value, size, filecount);
  +    (void)sprintf(CS buffer, "%.30gS,%dC\n%.30g %d\n", (double)ob->quota_value,
  +      ob->quota_filecount_value, (double)size, filecount);
       len = Ustrlen(buffer);
       if (write(fd, buffer, len) != len || Urename(tempname, filename) < 0)
         {
  @@ -538,8 +538,8 @@


/* Return the sizes and the file descriptor, if any */

-DEBUG(D_transport) debug_printf("returning maildir size=%d filecount=%d\n",
- size, filecount);
+DEBUG(D_transport) debug_printf("returning maildir size=%.30g filecount=%d\n",
+ (double)size, filecount);
*returned_size = size;
*returned_filecount = filecount;
return fd;

  Index: tf_maildir.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transports/tf_maildir.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- tf_maildir.h    4 Jan 2005 10:00:45 -0000    1.2
  +++ tf_maildir.h    7 Jun 2005 15:20:56 -0000    1.3
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transports/tf_maildir.h,v 1.2 2005/01/04 10:00:45 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transports/tf_maildir.h,v 1.3 2005/06/07 15:20:56 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -10,12 +10,12 @@
   /* Header file for the functions that are used to support the use of
   maildirsize files for quota handling in maildir directories. */


  -extern int  maildir_compute_size(uschar *, int *, time_t *, const pcre *,
  -              const pcre *, BOOL);
  -extern BOOL maildir_ensure_directories(uschar *, address_item *, BOOL, int);
  -extern int  maildir_ensure_sizefile(uschar *,
  -              appendfile_transport_options_block *, const pcre *, const pcre *,
  -              int *, int *);
  -extern void maildir_record_length(int, int);
  +extern off_t  maildir_compute_size(uschar *, int *, time_t *, const pcre *,
  +                const pcre *, BOOL);
  +extern BOOL   maildir_ensure_directories(uschar *, address_item *, BOOL, int);
  +extern int    maildir_ensure_sizefile(uschar *,
  +                appendfile_transport_options_block *, const pcre *,
  +                const pcre *, off_t *, int *);
  +extern void   maildir_record_length(int, int);


/* End of tf_maildir.h */