Add ${rfc2047d: expansion.
authorPhilip Hazel <ph10@hermes.cam.ac.uk>
Wed, 31 Jan 2007 11:30:08 +0000 (11:30 +0000)
committerPhilip Hazel <ph10@hermes.cam.ac.uk>
Wed, 31 Jan 2007 11:30:08 +0000 (11:30 +0000)
doc/doc-txt/ChangeLog
doc/doc-txt/NewStuff
src/ACKNOWLEDGMENTS
src/src/expand.c
test/scripts/0000-Basic/0002
test/stdout/0002

index f487761c7884836a0bda5bf914580edf32bdb737..e36d4bb50df990f7a9ae5ac59fd5f28ecd824bc7 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.465 2007/01/30 15:10:58 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.466 2007/01/31 11:30:08 ph10 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -67,6 +67,8 @@ PH/12 Added $sending_ip_address and $sending_port (mostly Magnus Holmgren's
       the connection is made in the smtp transport (so it can use these
       values).
 
       the connection is made in the smtp transport (so it can use these
       values).
 
+PH/13 Added ${rfc2047d: to decoded RFC 2047 strings.
+
 
 Exim version 4.66
 -----------------
 
 Exim version 4.66
 -----------------
index bdfe78c22f0cec0d1b16b58ac131b8f9646f9c11..cfa846c4892797408fb2a9955d6bbd034817e555 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.132 2007/01/30 15:10:58 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.133 2007/01/31 11:30:08 ph10 Exp $
 
 New Features in Exim
 --------------------
 
 New Features in Exim
 --------------------
@@ -222,6 +222,12 @@ Version 4.67
     The use of helo_data applies both to sending messages and when doing
     callouts.
 
     The use of helo_data applies both to sending messages and when doing
     callouts.
 
+ 9. There is a new expansion operator ${rfc2047d: that decodes strings that
+    are encoded as per RFC 2047. Binary zero bytes are replaced by question
+    marks. Characters are converted into the character set defined by
+    headers_charset. Overlong RFC 2047 "words" are not recognized unless
+    check_rfc2047_length is set false.
+
 
 Version 4.66
 ------------
 
 Version 4.66
 ------------
index 23a6de7ff542a5d2fa1c18e667432e1c841679bb..a855be12cbea36a548fda02c82a0d5fe06423809 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.69 2007/01/30 15:10:59 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.70 2007/01/31 11:30:08 ph10 Exp $
 
 EXIM ACKNOWLEDGEMENTS
 
 
 EXIM ACKNOWLEDGEMENTS
 
@@ -20,7 +20,7 @@ relatively small patches.
 Philip Hazel
 
 Lists created: 20 November 2002
 Philip Hazel
 
 Lists created: 20 November 2002
-Last updated:  30 January 2007
+Last updated:  31 January 2007
 
 
 THE OLD LIST
 
 
 THE OLD LIST
@@ -167,7 +167,8 @@ Jakob Hirsch              Patch for % operator
 Magnus Holmgren           Patch for filter_prepend_home
                           Patch for "h" flag in Domain Keys
                           Patch for $sending_ip_address/$sending_port
 Magnus Holmgren           Patch for filter_prepend_home
                           Patch for "h" flag in Domain Keys
                           Patch for $sending_ip_address/$sending_port
-                          Lots of other support
+                          Patch for ${rfc2047d:
+                          Lots of other maintenance support
 Kjetil Torgrim Homme      Patch for require_files problem on NFS file systems
 Tom Hughes                Suggested patch for $n bug in pipe command from filter
 Pierre Humblet            Continued Cygwin support
 Kjetil Torgrim Homme      Patch for require_files problem on NFS file systems
 Tom Hughes                Suggested patch for $n bug in pipe command from filter
 Pierre Humblet            Continued Cygwin support
index a9b4749392081af6291446ae9fa871fb12c29024..b2674dd4220734f150f061a9944cbbcefccde4b8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.78 2007/01/30 15:10:59 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.79 2007/01/31 11:30:08 ph10 Exp $ */
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
 
 /*************************************************
 *     Exim - an Internet mail transport agent    *
@@ -181,6 +181,7 @@ static uschar *op_table_main[] = {
   US"nhash",
   US"quote",
   US"rfc2047",
   US"nhash",
   US"quote",
   US"rfc2047",
+  US"rfc2047d",
   US"rxquote",
   US"s",
   US"sha1",
   US"rxquote",
   US"s",
   US"sha1",
@@ -211,6 +212,7 @@ enum {
   EOP_NHASH,
   EOP_QUOTE,
   EOP_RFC2047,
   EOP_NHASH,
   EOP_QUOTE,
   EOP_RFC2047,
+  EOP_RFC2047D,
   EOP_RXQUOTE,
   EOP_S,
   EOP_SHA1,
   EOP_RXQUOTE,
   EOP_S,
   EOP_SHA1,
@@ -5084,6 +5086,23 @@ while (*s != 0)
         continue;
         }
 
         continue;
         }
 
+      /* RFC 2047 decode */
+
+      case EOP_RFC2047D:
+        {
+        int len;
+        uschar *error;
+        uschar *decoded = rfc2047_decode(sub, check_rfc2047_length,
+          headers_charset, '?', &len, &error);
+        if (error != NULL)
+          {
+          expand_string_message = error;
+          goto EXPAND_FAILED;
+          }
+        yield = string_cat(yield, &size, &ptr, decoded, len);
+        continue;
+        }
+
       /* from_utf8 converts UTF-8 to 8859-1, turning non-existent chars into
       underscores */
 
       /* from_utf8 converts UTF-8 to 8859-1, turning non-existent chars into
       underscores */
 
index c31b9232f4266161b248d27d07f1cfff21a3aeeb..f32b605b0b5b672dce828712984c54d5cbdf0df2 100644 (file)
@@ -502,6 +502,13 @@ abcd      ${rfc2047:abcd}
 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit}
 
 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit}
 
+# RFC 2047 decode
+
+${rfc2047d:abcd      abcd}
+${rfc2047d:<:abcd:>  =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
+${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
+${rfc2047d:Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=}
+${rfc2047d:Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=}
 
 # UTF-8
 
 
 # UTF-8
 
index a4e6feb2ff88da90cfd00a1e8ee915ba6b5ebc2c..623e5769bddfeeca16a2f0fe53e58e5890c02a19 100644 (file)
 > Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=
 > Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=
 > 
 > Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=
 > Long:     =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=
 > 
+> # RFC 2047 decode
+> 
+> abcd      abcd
+> <:abcd:>  <:abcd:>
+> <:ab cd:> <:ab cd:>
+> Long:      here we go: a string that is going to be encoded: it will go over the 75-char limit
+> Long:      here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit
 > 
 > # UTF-8
 > 
 > 
 > # UTF-8
 >