From a0d6ba8acc09196843fdea4132bb0814b2e81132 Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Tue, 15 Nov 2005 10:08:24 +0000 Subject: [PATCH] Add check_rfc2047_length to disable length checking for encoded words. --- doc/doc-txt/ChangeLog | 6 +++++- src/ACKNOWLEDGMENTS | 5 +++-- src/src/expand.c | 5 +++-- src/src/globals.c | 3 ++- src/src/globals.h | 3 ++- src/src/mime.c | 4 ++-- src/src/readconf.c | 3 ++- src/src/sieve.c | 4 ++-- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 050fa034b..13e8b4272 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.261 2005/11/15 09:44:33 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.262 2005/11/15 10:08:24 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -126,6 +126,10 @@ PH/13 After a successful wildlsearch lookup, discard the values of numeric variables because (a) they are in the wrong storage pool and (b) even if they were copied, it wouldn't work properly because of the caching. +PH/14 Add check_rfc2047_length to disable enforcement of RFC 2047 length + checking when decoding. Apparently there are clients that generate + overlong encoded strings. Why am I not surprised? + Exim version 4.54 ----------------- diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index 7d5f270ba..e4b9ee1b7 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.37 2005/11/02 16:32:58 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.38 2005/11/15 10:08:25 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -20,7 +20,7 @@ relatively small patches. Philip Hazel Lists created: 20 November 2002 -Last updated: 02 November 2005 +Last updated: 15 November 2005 THE OLD LIST @@ -185,6 +185,7 @@ Everton da Silva Marques Suggested patch for SRV handling Suggested patch for SRV/MX lookup retry option Nikos Mavrogiannopoulos GnuTLS proof of concept code Update to RSA and D-H parameter caching code +Komar Maxim Patch for check_rfc2047_length Andy Mell Fix for rejectlog regeneration bug Marc Merlin Many suggestions and patches for callouts and SMTP error message features diff --git a/src/src/expand.c b/src/src/expand.c index a501cfe04..f171c002c 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/expand.c,v 1.46 2005/10/12 11:20:41 ph10 Exp $ */ +/* $Cambridge: exim/src/src/expand.c,v 1.47 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1205,7 +1205,8 @@ else uschar *decoded, *error; while (ptr > yield && isspace(ptr[-1])) ptr--; *ptr = 0; - decoded = rfc2047_decode2(yield, TRUE, charset, '?', NULL, newsize, &error); + decoded = rfc2047_decode2(yield, check_rfc2047_length, charset, '?', NULL, + newsize, &error); if (error != NULL) { DEBUG(D_any) debug_printf("*** error in RFC 2047 decoding: %s\n" diff --git a/src/src/globals.c b/src/src/globals.c index 127af7607..9d2feb76e 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.c,v 1.41 2005/11/14 16:09:54 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.c,v 1.42 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -372,6 +372,7 @@ uschar *callout_random_local_part = US"$primary_hostname-$tod_epoch-testing"; uschar *check_dns_names_pattern= US"(?i)^(?>(?(1)\\.|())[^\\W_](?>[a-z0-9-]*[^\\W_])?)+$"; int check_log_inodes = 0; int check_log_space = 0; +BOOL check_rfc2047_length = TRUE; int check_spool_inodes = 0; int check_spool_space = 0; int clmacro_count = 0; diff --git a/src/src/globals.h b/src/src/globals.h index 3d8a45be5..140502a8e 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/globals.h,v 1.29 2005/09/13 11:13:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/globals.h,v 1.30 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -195,6 +195,7 @@ extern uschar *callout_random_local_part; /* Local part to be used to check if s extern uschar *check_dns_names_pattern;/* Regex for syntax check */ extern int check_log_inodes; /* Minimum for message acceptance */ extern int check_log_space; /* Minimum for message acceptance */ +extern BOOL check_rfc2047_length; /* Check RFC 2047 encoded string length */ extern int check_spool_inodes; /* Minimum for message acceptance */ extern int check_spool_space; /* Minimum for message acceptance */ extern int clmacro_count; /* Number of command line macros */ diff --git a/src/src/mime.c b/src/src/mime.c index 486fd3d1f..e0ac66cbe 100644 --- a/src/src/mime.c +++ b/src/src/mime.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/mime.c,v 1.12 2005/08/16 12:32:32 tom Exp $ */ +/* $Cambridge: exim/src/src/mime.c,v 1.13 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -619,7 +619,7 @@ int mime_acl_check(uschar *acl, FILE *f, struct mime_boundary_context *context, memset(param_value,0,param_value_len+1); q = p + mime_parameter_list[j].namelen; Ustrncpy(param_value, q, param_value_len); - param_value = rfc2047_decode(param_value, TRUE, NULL, 32, ¶m_value_len, &q); + param_value = rfc2047_decode(param_value, check_rfc2047_length, NULL, 32, ¶m_value_len, &q); debug_printf("Found %s MIME parameter in %s header, value is '%s'\n", mime_parameter_list[j].name, mime_header_list[i].name, param_value); *((uschar **)(mime_parameter_list[j].value)) = param_value; p += (mime_parameter_list[j].namelen + param_value_len + 1); diff --git a/src/src/readconf.c b/src/src/readconf.c index 2a0b9d120..0751b7750 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/readconf.c,v 1.14 2005/09/19 14:01:51 ph10 Exp $ */ +/* $Cambridge: exim/src/src/readconf.c,v 1.15 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -182,6 +182,7 @@ static optionlist optionlist_config[] = { { "callout_random_local_part",opt_stringptr, &callout_random_local_part }, { "check_log_inodes", opt_int, &check_log_inodes }, { "check_log_space", opt_Kint, &check_log_space }, + { "check_rfc2047_length", opt_bool, &check_rfc2047_length }, { "check_spool_inodes", opt_int, &check_spool_inodes }, { "check_spool_space", opt_Kint, &check_spool_space }, { "daemon_smtp_port", opt_stringptr|opt_hidden, &daemon_smtp_port }, diff --git a/src/src/sieve.c b/src/src/sieve.c index b8ade713b..f92ac0369 100644 --- a/src/src/sieve.c +++ b/src/src/sieve.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/sieve.c,v 1.14 2005/11/14 11:41:23 ph10 Exp $ */ +/* $Cambridge: exim/src/src/sieve.c,v 1.15 2005/11/15 10:08:25 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -800,7 +800,7 @@ while (*r) *t++=*r++; } *t++='\0'; -value->character=rfc2047_decode(s,TRUE,US"utf-8",'\0',&value->length,&errmsg); +value->character=rfc2047_decode(s,check_rfc2047_length,US"utf-8",'\0',&value->length,&errmsg); } -- 2.25.1