summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mail-client/mutt/files/mutt-1.5.20-rfc-2047-decode-before-dequote-2a4ca6917fd0.patch')
-rw-r--r--mail-client/mutt/files/mutt-1.5.20-rfc-2047-decode-before-dequote-2a4ca6917fd0.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/mail-client/mutt/files/mutt-1.5.20-rfc-2047-decode-before-dequote-2a4ca6917fd0.patch b/mail-client/mutt/files/mutt-1.5.20-rfc-2047-decode-before-dequote-2a4ca6917fd0.patch
new file mode 100644
index 000000000000..0da93d5a74f4
--- /dev/null
+++ b/mail-client/mutt/files/mutt-1.5.20-rfc-2047-decode-before-dequote-2a4ca6917fd0.patch
@@ -0,0 +1,116 @@
+http://dev.mutt.org/trac/ticket/2014
+http://dev.mutt.org/hg/mutt/rev/165b998920e4
+http://dev.mutt.org/hg/mutt/rev/cc02f079b1b9
+http://dev.mutt.org/hg/mutt/rev/41cf44ddbb4c
+http://dev.mutt.org/hg/mutt/rev/fec2720ff6ef
+
+# HG changeset patch
+# User Brendan Cully <brendan@kublai.com>
+# Date 1267511730 28800
+# Node ID 165b998920e45655aef33c74b76fe39b9ec9dc0b
+# Parent 86d93280e5b32af477502f124f5b12f65f879e53
+Another attempt to dequote RFC2047-encoded address comments (see #2014)
+
+diff -r 86d93280e5b3 -r 165b998920e4 copy.c
+--- a/copy.c Mon Mar 01 16:14:57 2010 -0800
++++ b/copy.c Mon Mar 01 22:35:30 2010 -0800
+@@ -868,6 +868,7 @@
+ int l, rp = 0;
+
+ ADDRESS *a = NULL;
++ ADDRESS *cur = NULL;
+
+ switch (tolower ((unsigned char) *s))
+ {
+@@ -937,6 +938,9 @@
+
+ mutt_addrlist_to_local (a);
+ rfc2047_decode_adrlist (a);
++ for (cur = a; cur; cur = cur->next)
++ if (cur->personal)
++ rfc822_dequote_comment (cur->personal);
+
+ /* angle brackets for return path are mandated by RfC5322,
+ * so leave Return-Path as-is */
+diff -r 86d93280e5b3 -r 165b998920e4 rfc822.c
+--- a/rfc822.c Mon Mar 01 16:14:57 2010 -0800
++++ b/rfc822.c Mon Mar 01 22:35:30 2010 -0800
+@@ -60,7 +60,7 @@
+ "bad address spec"
+ };
+
+-static void rfc822_dequote_comment (char *s)
++void rfc822_dequote_comment (char *s)
+ {
+ char *w = s;
+
+@@ -177,17 +177,10 @@
+ static const char *
+ parse_quote (const char *s, char *token, size_t *tokenlen, size_t tokenmax)
+ {
+- if (*tokenlen < tokenmax)
+- token[(*tokenlen)++] = '"';
+ while (*s)
+ {
+ if (*tokenlen < tokenmax)
+ token[*tokenlen] = *s;
+- if (*s == '"')
+- {
+- (*tokenlen)++;
+- return (s + 1);
+- }
+ if (*s == '\\')
+ {
+ if (!*++s)
+@@ -196,6 +189,8 @@
+ if (*tokenlen < tokenmax)
+ token[*tokenlen] = *s;
+ }
++ else if (*s == '"')
++ return (s + 1);
+ (*tokenlen)++;
+ s++;
+ }
+@@ -431,6 +426,17 @@
+ }
+ s = ps;
+ }
++ else if (*s == '"')
++ {
++ if (phraselen && phraselen < sizeof (phrase) - 1)
++ phrase[phraselen++] = ' ';
++ if ((ps = parse_quote (s + 1, phrase, &phraselen, sizeof (phrase) - 1)) == NULL)
++ {
++ rfc822_free_address (&top);
++ return NULL;
++ }
++ s = ps;
++ }
+ else if (*s == ':')
+ {
+ cur = rfc822_new_address ();
+@@ -490,13 +496,7 @@
+ terminate_buffer (phrase, phraselen);
+ cur = rfc822_new_address ();
+ if (phraselen)
+- {
+- if (cur->personal)
+- FREE (&cur->personal);
+- /* if we get something like "Michael R. Elkins" remove the quotes */
+- rfc822_dequote_comment (phrase);
+ cur->personal = safe_strdup (phrase);
+- }
+ if ((ps = parse_route_addr (s + 1, comment, &commentlen, sizeof (comment) - 1, cur)) == NULL)
+ {
+ rfc822_free_address (&top);
+diff -r 86d93280e5b3 -r 165b998920e4 rfc822.h
+--- a/rfc822.h Mon Mar 01 16:14:57 2010 -0800
++++ b/rfc822.h Mon Mar 01 22:35:30 2010 -0800
+@@ -46,6 +46,7 @@
+ }
+ ADDRESS;
+
++void rfc822_dequote_comment (char *s);
+ void rfc822_free_address (ADDRESS **);
+ void rfc822_qualify (ADDRESS *, const char *);
+ ADDRESS *rfc822_parse_adrlist (ADDRESS *, const char *s);