ph10 2005/04/27 14:29:33 BST
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src ACKNOWLEDGMENTS
exim-src/src expand.c receive.c smtp_in.c
exim-test-orig/AutoTest/confs 005
exim-test-orig/AutoTest/log 005
exim-test-orig/AutoTest/mail 005.ph10
exim-test-orig/AutoTest/scripts 005
Log:
Install Tony's patch for $message_linecount.
Revision Changes Path
1.127 +4 -0 exim/exim-doc/doc-txt/ChangeLog
1.37 +18 -0 exim/exim-doc/doc-txt/NewStuff
1.24 +1 -0 exim/exim-src/ACKNOWLEDGMENTS
1.19 +1 -0 exim/exim-src/src/expand.c
1.16 +8 -5 exim/exim-src/src/receive.c
1.17 +1 -0 exim/exim-src/src/smtp_in.c
1.2 +6 -0 exim/exim-test-orig/AutoTest/confs/005
1.2 +3 -3 exim/exim-test-orig/AutoTest/log/005
1.2 +10 -1 exim/exim-test-orig/AutoTest/mail/005.ph10
1.2 +6 -1 exim/exim-test-orig/AutoTest/scripts/005
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- ChangeLog 27 Apr 2005 10:55:20 -0000 1.126
+++ ChangeLog 27 Apr 2005 13:29:32 -0000 1.127
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.126 2005/04/27 10:55:20 ph10 Exp $
+$Cambridge: exim/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
-------------------------------------------
@@ -244,6 +244,10 @@
to spool files. There was no check on this. Now the value is run through
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
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- NewStuff 27 Apr 2005 10:06:00 -0000 1.36
+++ NewStuff 27 Apr 2005 13:29:32 -0000 1.37
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.36 2005/04/27 10:06:00 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.37 2005/04/27 13:29:32 ph10 Exp $
New Features in Exim
--------------------
@@ -148,6 +148,24 @@
:user. An unset subaddress is treated as an empty subaddress.
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
Index: ACKNOWLEDGMENTS
===================================================================
RCS file: /home/cvs/exim/exim-src/ACKNOWLEDGMENTS,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ACKNOWLEDGMENTS 27 Apr 2005 10:00:18 -0000 1.23
+++ ACKNOWLEDGMENTS 27 Apr 2005 13:29:32 -0000 1.24
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.23 2005/04/27 10:00:18 ph10 Exp $
+$Cambridge: exim/exim-src/ACKNOWLEDGMENTS,v 1.24 2005/04/27 13:29:32 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -127,6 +127,7 @@
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
Index: expand.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/expand.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- expand.c 22 Mar 2005 16:52:06 -0000 1.18
+++ expand.c 27 Apr 2005 13:29:32 -0000 1.19
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/expand.c,v 1.18 2005/03/22 16:52:06 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
{ "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 },
Index: receive.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/receive.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- receive.c 7 Apr 2005 15:40:50 -0000 1.15
+++ receive.c 27 Apr 2005 13:29:32 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/receive.c,v 1.15 2005/04/07 15:40:50 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
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 @@
/* 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 @@
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 */
Index: smtp_in.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/smtp_in.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- smtp_in.c 27 Apr 2005 10:55:20 -0000 1.16
+++ smtp_in.c 27 Apr 2005 13:29:32 -0000 1.17
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.16 2005/04/27 10:55:20 ph10 Exp $ */
+/* $Cambridge: exim/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 @@
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;
Index: 005
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/confs/005,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 005 8 Oct 2004 14:49:15 -0000 1.1
+++ 005 27 Apr 2005 13:29:33 -0000 1.2
@@ -12,6 +12,7 @@
domainlist local_domains = xoanon.csi.cam.ac.uk
acl_smtp_rcpt = check_recipient
+acl_smtp_data = check_data
message_id_header_domain = ${if eq{0}{0}{some.domain}}
message_id_header_text = ${if eq{0}{0}{a@b[c]}}
trusted_users = CALLER
@@ -25,6 +26,10 @@
accept hosts = :
accept domains = +local_domains
deny message = relay not permitted
+
+check_data:
+ warn message = X-acl-message-linecount: $message_linecount
+ accept
# ----- Routers -----
@@ -53,6 +58,7 @@
envelope_to_add
file = DIR/test-mail/$local_part
headers_add = "X-body-linecount: $body_linecount\n\
+ X-message-linecount: $message_linecount\n\
X-received-count: $received_count"
return_path_add
Index: 005
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/log/005,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 005 8 Oct 2004 14:49:31 -0000 1.1
+++ 005 27 Apr 2005 13:29:33 -0000 1.2
@@ -1,9 +1,9 @@
-1999-03-02 09:44:33 10HmaX-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=339
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=366
1999-03-02 09:44:33 10HmaX-0005vi-00 => ph10 <ph10@???> R=localuser T=local_delivery
1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaY-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=303
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=346
1999-03-02 09:44:33 10HmaY-0005vi-00 => ph10 <ph10@???> R=localuser T=local_delivery
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
-1999-03-02 09:44:33 10HmaZ-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=303
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= ph10@??? U=ph10 P=local-smtp S=364
1999-03-02 09:44:33 10HmaZ-0005vi-00 => ph10 <ph10@???> R=localuser T=local_delivery
1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
Index: 005.ph10
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/mail/005.ph10,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 005.ph10 8 Oct 2004 14:49:42 -0000 1.1
+++ 005.ph10 27 Apr 2005 13:29:33 -0000 1.2
@@ -8,8 +8,10 @@
Message-Id: <E10HmaX-0005vi-00.a-b-c-@???>
From: ph10@???
Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-acl-message-linecount: 4
X-local-user: uid=1169 gid=1169
X-body-linecount: 3
+X-message-linecount: 10
X-received-count: 1
This is a test message.
@@ -23,11 +25,14 @@
Received: from ph10 by xoanon.csi.cam.ac.uk with local-smtp (Exim x.yz)
id 10HmaY-0005vi-00
for ph10@???; Tue, 2 Mar 1999 09:44:33 +0000
+Subject: second
Message-Id: <E10HmaY-0005vi-00.a-b-c-@???>
From: ph10@???
Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-acl-message-linecount: 3
X-local-user: uid=1169 gid=1169
X-body-linecount: 1
+X-message-linecount: 9
X-received-count: 1
This is a second test message.
@@ -39,12 +44,16 @@
Received: from ph10 by xoanon.csi.cam.ac.uk with local-smtp (Exim x.yz)
id 10HmaZ-0005vi-00
for ph10@???; Tue, 2 Mar 1999 09:44:33 +0000
+Subject: third
+Reply-to: some@body
Message-Id: <E10HmaZ-0005vi-00.a-b-c-@???>
From: ph10@???
Date: Tue, 2 Mar 1999 09:44:33 +0000
+X-acl-message-linecount: 4
X-local-user: uid=1169 gid=1169
X-body-linecount: 1
+X-message-linecount: 10
X-received-count: 1
-This is a second test message.
+This is a third test message.
Index: 005
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/scripts/005,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 005 8 Oct 2004 14:49:52 -0000 1.1
+++ 005 27 Apr 2005 13:29:33 -0000 1.2
@@ -14,6 +14,8 @@
mail from:ph10@???
rcpt to:ph10@???
data
+Subject: second
+
This is a second test message.
.
quit
@@ -23,7 +25,10 @@
mail from:ph10@???
rcpt to:ph10@???
data
-This is a second test message.
+Subject: third
+Reply-to: some@body
+
+This is a third test message.
.
quit
****