From: Philip Hazel Date: Wed, 27 Apr 2005 13:29:32 +0000 (+0000) Subject: Install Tony's patch for $message_linecount. X-Git-Tag: exim-4_51~9 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/2e0c1448cf7e5612a17b4ff09fe7a05235cce7f2 Install Tony's patch for $message_linecount. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 9aed3bb90..d8272ab92 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.126 2005/04/27 10:55:20 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.127 2005/04/27 13:29:32 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -245,6 +245,10 @@ PH/40 The value set for $authenticated_id in an authenticator may not contain the string_printing() function so that such characters are converted to printable escape sequences. +PH/41 $message_linecount is a new variable that contains the total number of + lines in the message. Compare $body_linecount, which is the count for the + body only. + A note about Exim versions 4.44 and 4.50 ---------------------------------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index f2e4006b7..bd6f2e8c1 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.36 2005/04/27 10:06:00 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.37 2005/04/27 13:29:32 ph10 Exp $ New Features in Exim -------------------- @@ -149,6 +149,24 @@ PH/08 The redirect router has two new options, sieve_useraddress and PH/09 Quota values can be followed by G as well as K and M. +PH/10 $message_linecount is a new variable that contains the total number of + lines in the header and body of the message. Compare $body_linecount, + which is the count for the body only. During the DATA and + content-scanning ACLs, $message_linecount contains the number of lines + received. Before delivery happens (that is, before filters, routers, and + transports run) the count is increased to include the Received: header + line that Exim standardly adds, and also any other header lines that are + added by ACLs. The blank line that separates the message header from the + body is not counted. Here is an example of the use of this variable in a + DATA ACL: + + deny message = Too many lines in message header + condition = \ + ${if <{250}{${eval: $message_linecount - $body_linecount}}} + + In the MAIL and RCPT ACLs, the value is zero because at that stage the + message has not yet been received. + Version 4.50 ------------ diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index acba7b758..e33abe3c8 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.23 2005/04/27 10:00:18 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.24 2005/04/27 13:29:32 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -127,6 +127,7 @@ Tony Finch Expansion extensions Patch for mxh lookup type in dnsdb Patch for defer_foo in dndsb Patch for ${dlfunc + Patch for $message_linecount Ian Freislich Patch for spamd timeout problem Giuliano Gavazzi Patches for OSX compilation Dominic Germain Patch for exiqgrep MacOS X bug diff --git a/src/src/expand.c b/src/src/expand.c index fda06c61d..b1f7d3f96 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.18 2005/03/22 16:52:06 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.19 2005/04/27 13:29:32 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -394,6 +394,7 @@ static var_entry var_table[] = { { "message_body_size", vtype_int, &message_body_size }, { "message_headers", vtype_msgheaders, NULL }, { "message_id", vtype_stringptr, &message_id }, + { "message_linecount", vtype_int, &message_linecount }, { "message_size", vtype_int, &message_size }, #ifdef WITH_CONTENT_SCAN { "mime_anomaly_level", vtype_int, &mime_anomaly_level }, diff --git a/src/src/receive.c b/src/src/receive.c index c83bca664..58c64f7c8 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/receive.c,v 1.15 2005/04/07 15:40:50 ph10 Exp $ */ +/* $Cambridge: exim/src/src/receive.c,v 1.16 2005/04/27 13:29:32 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1339,11 +1339,9 @@ received_count = 1; /* For the one we will add */ if (thismessage_size_limit <= 0) thismessage_size_limit = INT_MAX; -/* While reading the message, body_linecount and body_zerocount is computed. -The full message_ linecount is set up only when the headers are read back in -from the spool for delivery. */ +/* While reading the message, the following counts are computed. */ -body_linecount = body_zerocount = 0; +message_linecount = body_linecount = body_zerocount = 0; #ifdef EXPERIMENTAL_DOMAINKEYS /* Call into DK to set up the context. Check if DK is to be run are carried out @@ -1573,7 +1571,11 @@ for (;;) /* End of header line reached */ EOL: - receive_linecount++; /* For BSMTP errors */ + + /* Keep track of lines for BSMTP errors and overall message_linecount. */ + + receive_linecount++; + message_linecount++; /* Now put in the terminating newline. There is always space for at least two more characters. */ @@ -2633,6 +2635,7 @@ if (!ferror(data_file) && !(receive_feof)() && message_ended != END_DOT) else message_ended = read_message_data(data_file); receive_linecount += body_linecount; /* For BSMTP errors mainly */ + message_linecount += body_linecount; /* Handle premature termination of SMTP */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index bdc323325..6e62b99e0 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.16 2005/04/27 10:55:20 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.17 2005/04/27 13:29:32 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -804,6 +804,7 @@ store_reset(reset_point); recipients_list = NULL; rcpt_count = rcpt_defer_count = rcpt_fail_count = raw_recipients_count = recipients_count = recipients_list_max = 0; +message_linecount = 0; message_size = -1; acl_warn_headers = NULL; queue_only_policy = FALSE;