From: Philip Hazel Date: Thu, 23 Aug 2007 11:01:49 +0000 (+0000) Subject: Add message_body_newlines. X-Git-Tag: exim-4_68~8 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=ddea74fabbf9135b146f96dd0a2a71a4b7100a86 Add message_body_newlines. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 9516dafbe..fd10f7b3c 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.526 2007/08/23 10:16:51 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.527 2007/08/23 11:01:49 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -88,13 +88,15 @@ PH/18 If a system quota error occurred while trying to create the file for bounce if the delivery eventually timed out. Change 4.67/27 below applied only to a quota excession during the actual writing of the file. -PH/10 It seems that peer DN values may contain newlines (and other non-printing +PH/19 It seems that peer DN values may contain newlines (and other non-printing characters?) which causes problems in log lines. The DN values are now passed through string_printing() before being added to log lines. -PH/11 Added the "servers=" facility to MySQL and PostgreSQL lookups. (Oracle +PH/20 Added the "servers=" facility to MySQL and PostgreSQL lookups. (Oracle and InterBase are left for another time.) +PH/21 Added message_body_newlines option. + Exim version 4.67 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index f58687ddb..e18d215aa 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.156 2007/08/23 10:16:51 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.157 2007/08/23 11:01:49 ph10 Exp $ New Features in Exim -------------------- @@ -151,6 +151,11 @@ Version 4.68 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} +11. The message_body_newlines option (default FALSE, for backwards + compatibility) can be used to control whether newlines are present in + $message_body and $message_body_end. If it is FALSE, they are replaced by + spaces. + Version 4.67 ------------ diff --git a/doc/doc-txt/OptionLists.txt b/doc/doc-txt/OptionLists.txt index 6c28ebdba..bb9880c6b 100644 --- a/doc/doc-txt/OptionLists.txt +++ b/doc/doc-txt/OptionLists.txt @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/OptionLists.txt,v 1.33 2007/06/27 11:01:51 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/OptionLists.txt,v 1.34 2007/08/23 11:01:49 ph10 Exp $ LISTS OF EXIM OPTIONS --------------------- @@ -337,6 +337,7 @@ max_output integer 20K pipe max_rcpt integer 100 smtp 1.60 max_user_name_length integer 0 main mbx_format boolean false appendfile 2.10 +message_body_newlines boolean false main 4.68 message_body_visible integer 500 main message_id_header_domain string* unset main 4.11 message_id_header_text string* unset main diff --git a/src/src/expand.c b/src/src/expand.c index be066a5a7..657d2b9f9 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.89 2007/08/22 10:10:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.90 2007/08/23 11:01:49 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1506,9 +1506,15 @@ while (last > first) if (len > 0) { body[len] = 0; - while (len > 0) + if (message_body_newlines) /* Separate loops for efficiency */ { - if (body[--len] == '\n' || body[len] == 0) body[len] = ' '; + while (len > 0) + { if (body[--len] == 0) body[len] = ' '; } + } + else + { + while (len > 0) + { if (body[--len] == '\n' || body[len] == 0) body[len] = ' '; } } } } diff --git a/src/src/globals.c b/src/src/globals.c index 55e9cbda4..74e87e6d3 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.77 2007/08/22 10:10:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.78 2007/08/23 11:01:49 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -754,6 +754,7 @@ int max_username_length = 0; int message_age = 0; uschar *message_body = NULL; uschar *message_body_end = NULL; +BOOL message_body_newlines = FALSE; int message_body_size = 0; int message_body_visible = 500; int message_ended = END_NOTSTARTED; diff --git a/src/src/globals.h b/src/src/globals.h index 473b31125..5b9733c38 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.58 2007/08/22 10:10:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.59 2007/08/23 11:01:49 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -438,6 +438,7 @@ extern int max_username_length; /* For systems with broken getpwnam() */ extern int message_age; /* In seconds */ extern uschar *message_body; /* Start of message body for filter */ extern uschar *message_body_end; /* End of message body for filter */ +extern BOOL message_body_newlines; /* FALSE => remove newlines */ extern int message_body_size; /* Sic */ extern int message_body_visible; /* Amount visible in message_body */ extern int message_ended; /* State of message reading and how ended */ diff --git a/src/src/readconf.c b/src/src/readconf.c index 2ac260d8b..d44c1e839 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/readconf.c,v 1.32 2007/08/22 10:10:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/readconf.c,v 1.33 2007/08/23 11:01:49 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -265,6 +265,7 @@ static optionlist optionlist_config[] = { { "log_timezone", opt_bool, &log_timezone }, { "lookup_open_max", opt_int, &lookup_open_max }, { "max_username_length", opt_int, &max_username_length }, + { "message_body_newlines", opt_bool, &message_body_newlines }, { "message_body_visible", opt_mkint, &message_body_visible }, { "message_id_header_domain", opt_stringptr, &message_id_domain }, { "message_id_header_text", opt_stringptr, &message_id_text }, diff --git a/test/confs/0046 b/test/confs/0046 index ab285012d..c70121b32 100644 --- a/test/confs/0046 +++ b/test/confs/0046 @@ -1,5 +1,7 @@ # Exim test configuration 0046 +NL=FALSE + exim_path = EXIM_PATH host_lookup_order = bydns rfc1413_query_timeout = 0s @@ -10,6 +12,7 @@ gecos_name = CALLER_NAME # ----- Main settings ----- +message_body_newlines = NL message_id_header_domain = test.ex qualify_domain = test.ex # Omit Received: so as to keep the header size fixed diff --git a/test/log/0046 b/test/log/0046 index 87f0d6b28..d7be77870 100644 --- a/test/log/0046 +++ b/test/log/0046 @@ -7,3 +7,6 @@ 1999-03-02 09:44:33 10HmaZ-0005vi-00 <= usery@test.ex U=CALLER P=local S=sss 1999-03-02 09:44:33 10HmaZ-0005vi-00 => userx R=localuser T=local_delivery 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed +1999-03-02 09:44:33 10HmbA-0005vi-00 <= usery@test.ex U=CALLER P=local S=sss +1999-03-02 09:44:33 10HmbA-0005vi-00 => userx R=localuser T=local_delivery +1999-03-02 09:44:33 10HmbA-0005vi-00 Completed diff --git a/test/mail/0046.userx b/test/mail/0046.userx index dd0381415..cf7f26ea0 100644 Binary files a/test/mail/0046.userx and b/test/mail/0046.userx differ diff --git a/test/scripts/0000-Basic/0046 b/test/scripts/0000-Basic/0046 index 62d7ec83b..6dfae1d48 100644 Binary files a/test/scripts/0000-Basic/0046 and b/test/scripts/0000-Basic/0046 differ