diff options
author | Phil Pennock <pdp@exim.org> | 2011-02-20 23:44:50 -0500 |
---|---|---|
committer | Phil Pennock <pdp@exim.org> | 2011-02-20 23:45:22 -0500 |
commit | 332f5cf3ddb43e1a85d70039211e73aa1a753ebd (patch) | |
tree | dcff58d76b286cdd4c4b54addcb116d712f1d889 /src | |
parent | cd59ab18b06626887aecef760c416ae7936924da (diff) |
Update $message_linecount for maildir_tag.
Patch from Mark Zealey.
Fixes bug 1055.
Diffstat (limited to 'src')
-rw-r--r-- | src/src/globals.c | 1 | ||||
-rw-r--r-- | src/src/globals.h | 1 | ||||
-rw-r--r-- | src/src/transport.c | 1 | ||||
-rw-r--r-- | src/src/transports/appendfile.c | 21 |
4 files changed, 20 insertions, 4 deletions
diff --git a/src/src/globals.c b/src/src/globals.c index 60ef8e0a8..fe3a2eeb5 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1254,6 +1254,7 @@ transport_instance transport_defaults = { }; int transport_count; +int transport_newlines; uschar **transport_filter_argv = NULL; int transport_filter_timeout; BOOL transport_filter_timed_out = FALSE; diff --git a/src/src/globals.h b/src/src/globals.h index 1f0463264..b0c26c425 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -785,6 +785,7 @@ extern int thismessage_size_limit; /* Limit for this message */ extern int timeout_frozen_after; /* Max time to keep frozen messages */ extern BOOL timestamps_utc; /* Use UTC for all times */ extern int transport_count; /* Count of bytes transported */ +extern int transport_newlines; /* Accurate count of number of newline chars transported */ extern uschar **transport_filter_argv; /* For on-the-fly filtering */ extern int transport_filter_timeout; /* Timeout for same */ extern BOOL transport_filter_timed_out; /* True if it did */ diff --git a/src/src/transport.c b/src/src/transport.c index e68a24dcb..504ef9e06 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -426,6 +426,7 @@ for (ptr = start; ptr < end; ptr++) if (use_crlf) *chunk_ptr++ = '\r'; *chunk_ptr++ = '\n'; + transport_newlines++; /* The check_string test (formerly "from hack") replaces the specific string at the start of a line with an escape string (e.g. "From " becomes diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index e53761582..6dbb35262 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -2782,6 +2782,7 @@ if (yield == OK && ob->mbx_format) functions. */ transport_count = 0; +transport_newlines = 0; /* Write any configured prefix text first */ @@ -2807,21 +2808,26 @@ file, use its parent in the RCPT TO. */ if (yield == OK && ob->use_bsmtp) { transport_count = 0; + transport_newlines = 0; if (ob->use_crlf) cr = US"\r"; if (!transport_write_string(fd, "MAIL FROM:<%s>%s\n", return_path, cr)) yield = DEFER; else { address_item *a; + transport_newlines++; for (a = addr; a != NULL; a = a->next) { address_item *b = testflag(a, af_pfr)? a->parent: a; if (!transport_write_string(fd, "RCPT TO:<%s>%s\n", transport_rcpt_address(b, tblock->rcpt_include_affixes), cr)) { yield = DEFER; break; } + transport_newlines++; } if (yield == OK && !transport_write_string(fd, "DATA%s\n", cr)) yield = DEFER; + else + transport_newlines++; } } @@ -2854,8 +2860,10 @@ if (yield == OK && ob->message_suffix != NULL && ob->message_suffix[0] != 0) /* If batch smtp, write the terminating dot. */ -if (yield == OK && ob->use_bsmtp && - !transport_write_string(fd, ".%s\n", cr)) yield = DEFER; +if (yield == OK && ob->use_bsmtp ) { + if(!transport_write_string(fd, ".%s\n", cr)) yield = DEFER; + else transport_newlines++; +} /* If MBX format is being used, all that writing was to the temporary file. However, if there was an earlier failure (Exim quota exceeded, for example), @@ -2873,6 +2881,8 @@ if (temp_file != NULL && ob->mbx_format) if (yield == OK) { transport_count = 0; /* Reset transport count for actual write */ + /* No need to reset transport_newlines as we're just using a block copy + * routine so the number won't be affected */ yield = copy_mbx_message(fd, fileno(temp_file), saved_size); } else if (errno >= 0) dataname = US"temporary file"; @@ -2890,10 +2900,13 @@ fsync() to be called for a FIFO. */ if (yield == OK && !isfifo && EXIMfsync(fd) < 0) yield = DEFER; -/* Update message_size to the accurate count of bytes written, including -added headers. */ +/* Update message_size and message_linecount to the accurate count of bytes +written, including added headers. Note; we subtract 1 from message_linecount as +this variable doesn't count the new line between the header and the body of the +message. */ message_size = transport_count; +message_linecount = transport_newlines - 1; /* If using a maildir++ quota file, add this message's size to it, and close the file descriptor, except when the quota has been disabled because we |