[exim-dev] [patch-fixed] new option check_rfc2047_max_length

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Komar A. Maxim
Datum:  
To: exim-dev
Betreff: [exim-dev] [patch-fixed] new option check_rfc2047_max_length

Option check_rfc2047_max_length switch on/off check length "Printed
Quotable" by RFC2047 (75 chars) in header decoding. Similar
to Outlook Express ingnored RFC, and ACL with regex contain localised
chars not work. This patch fix this.

Perhaps it is useful not only for me ;-)

--
gate%p0~> finger komar@???
[maxim.org.ua]
finger: reading from network: Connection refused
diff -ur exim4-4.54/src/expand.c exim4-4.54.komar.fix/src/expand.c
--- exim4-4.54/src/expand.c    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/expand.c    2005-10-21 02:27:22.000000000 +0200
@@ -1205,7 +1205,7 @@
   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_max_length, charset, '?', NULL, newsize, &error);
   if (error != NULL)
     {
     DEBUG(D_any) debug_printf("*** error in RFC 2047 decoding: %s\n"
diff -ur exim4-4.54/src/globals.c exim4-4.54.komar.fix/src/globals.c
--- exim4-4.54/src/globals.c    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/globals.c    2005-10-21 02:53:23.000000000 +0200
@@ -372,6 +372,7 @@
 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_max_length = TRUE;
 int     check_spool_inodes     = 0;
 int     check_spool_space      = 0;
 int     clmacro_count          = 0;
diff -ur exim4-4.54/src/globals.h exim4-4.54.komar.fix/src/globals.h
--- exim4-4.54/src/globals.h    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/globals.h    2005-10-21 02:53:22.000000000 +0200
@@ -195,6 +195,7 @@
 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_max_length; /* Check RFC2047 max 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 -ur exim4-4.54/src/mime.c exim4-4.54.komar.fix/src/mime.c
--- exim4-4.54/src/mime.c    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/mime.c    2005-10-21 02:27:01.000000000 +0200
@@ -619,7 +619,7 @@
                 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, &param_value_len, &q);
+                param_value = rfc2047_decode(param_value, check_rfc2047_max_length, NULL, 32, &param_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 -ur exim4-4.54/src/readconf.c exim4-4.54.komar.fix/src/readconf.c
--- exim4-4.54/src/readconf.c    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/readconf.c    2005-10-21 02:53:22.000000000 +0200
@@ -182,6 +182,7 @@
   { "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_max_length", opt_bool,        &check_rfc2047_max_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 -ur exim4-4.54/src/sieve.c exim4-4.54.komar.fix/src/sieve.c
--- exim4-4.54/src/sieve.c    2005-10-04 10:55:28.000000000 +0200
+++ exim4-4.54.komar.fix/src/sieve.c    2005-10-21 02:27:13.000000000 +0200
@@ -790,7 +790,7 @@
     *t++=*r++;
   }
 *t++='\0';
-value->character=rfc2047_decode(s,TRUE,US"utf-8",'\0',&value->length,&errmsg);
+value->character=rfc2047_decode(s,check_rfc2047_max_length,US"utf-8",'\0',&value->length,&errmsg);
 }