Package: alpine
Version: 2.20+dfsg1-7
Severity: wishlist
Tags: patch

I’ve got eMail contact with a person using a big Telco’s webmailer
which apparently chokes ok “CHARSET=UTF-8” but handles “charset=UTF-8”
just fine.

Please find attached a patch working around this recipient side bug
by sending what it eats. (I’m also reporting to that Telco, but you
can imagine how well that is likely to go.)

-- System Information:
Debian Release: 9.0
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: i386, amd64

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)

Versions of packages alpine depends on:
ii  libc6             2.24-9
ii  libgssapi-krb5-2  1.15-1
ii  libkrb5-3         1.15-1
ii  libldap-2.4-2     2.4.44+dfsg-3
ii  libpam0g          1.1.8-3.5
ii  libssl1.0.2       1.0.2k-1
ii  libtinfo5         6.0+20161126-1
ii  mlock             8:2007f~dfsg-5

Versions of packages alpine recommends:
pn  alpine-doc  <none>

Versions of packages alpine suggests:
ii  aspell                          0.60.7~20110707-3+b1
ii  postfix [mail-transport-agent]  3.1.4-4

-- no debconf information
diff -Nru alpine-2.20+dfsg1/debian/changelog alpine-2.20+dfsg1/debian/changelog
--- alpine-2.20+dfsg1/debian/changelog  2016-12-20 09:23:45.000000000 +0100
+++ alpine-2.20+dfsg1/debian/changelog  2017-03-06 12:23:10.000000000 +0100
@@ -1,3 +1,11 @@
+alpine (2.20+dfsg1-7.0tarent1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Lowercase certain RFC822 header parameters to increase
+    compatibility with broken recipient MUAs
+
+ -- Thorsten Glaser <[email protected]>  Mon, 06 Mar 2017 12:23:10 +0100
+
 alpine (2.20+dfsg1-7) unstable; urgency=medium
 
   * Make the build reproducible. Thanks Chris Lamb. (Closes: #791923)
diff -Nru alpine-2.20+dfsg1/debian/patches/91_lowercase.patch 
alpine-2.20+dfsg1/debian/patches/91_lowercase.patch
--- alpine-2.20+dfsg1/debian/patches/91_lowercase.patch 1970-01-01 
01:00:00.000000000 +0100
+++ alpine-2.20+dfsg1/debian/patches/91_lowercase.patch 2017-03-06 
12:23:06.000000000 +0100
@@ -0,0 +1,58 @@
+# DP: lowercase some header parameters for increased compatibility
+
+--- a/imap/src/c-client/rfc822.c
++++ b/imap/src/c-client/rfc822.c
+@@ -1458,6 +1458,20 @@ static long rfc822_output_string (RFC822
+   return rfc822_output_data (buf,string,strlen (string));
+ }
+ 
++static long rfc822_output_string_lc (RFC822BUFFER *buf,char *string)
++{
++  char *lcstring;
++  size_t nstring;
++  long rv;
++
++  nstring = strlen (string);
++  if (!(lcstring = malloc (nstring + 1)))
++              return NIL;
++  memcpy (lcstring, string, nstring + 1);
++  rv = rfc822_output_data (buf, lcase (lcstring), nstring);
++  free (lcstring);
++  return rv;
++}
+ 
+ /* Flush buffer
+  * Accepts: buffer
+@@ -1705,7 +1719,7 @@ long rfc822_output_parameter (RFC822BUFF
+ {
+   while (param) {
+     if (rfc822_output_string (buf,"; ") &&
+-      rfc822_output_string (buf,param->attribute) &&
++      rfc822_output_string_lc (buf,param->attribute) &&
+       rfc822_output_char (buf,'=') &&
+       rfc822_output_cat (buf,param->value,tspecials)) param = param->next;
+     else return NIL;
+@@ -1739,19 +1753,19 @@ long rfc822_output_body_header (RFC822BU
+ {
+   return                      /* type and subtype*/
+     rfc822_output_string (buf,"Content-Type: ") &&
+-    rfc822_output_string (buf,body_types[body->type]) &&
++    rfc822_output_string_lc (buf,body_types[body->type]) &&
+     rfc822_output_char (buf,'/') &&
+-    rfc822_output_string (buf,body->subtype ? body->subtype :
++    rfc822_output_string_lc (buf,body->subtype ? body->subtype :
+                         rfc822_default_subtype (body->type)) &&
+                               /* parameters (w/ US-ASCII default */
+     (body->parameter ? rfc822_output_parameter (buf,body->parameter) :
+      ((body->type != TYPETEXT) ||
+-      (rfc822_output_string (buf,"; CHARSET=") &&
++      (rfc822_output_string (buf,"; charset=") &&
+        rfc822_output_string (buf,(body->encoding == ENC7BIT) ?
+                            "US-ASCII" : "X-UNKNOWN")))) &&
+     (!body->encoding ||           /* note: 7BIT never output as encoding! */
+      (rfc822_output_string (buf,"\015\012Content-Transfer-Encoding: ") &&
+-      rfc822_output_string (buf,body_encodings[body->encoding]))) &&
++      rfc822_output_string_lc (buf,body_encodings[body->encoding]))) &&
+     (!body->id ||             /* identification */
+      (rfc822_output_string (buf,"\015\012Content-ID: ") &&
+       rfc822_output_string (buf,body->id))) &&
diff -Nru alpine-2.20+dfsg1/debian/patches/series 
alpine-2.20+dfsg1/debian/patches/series
--- alpine-2.20+dfsg1/debian/patches/series     2016-12-20 09:23:01.000000000 
+0100
+++ alpine-2.20+dfsg1/debian/patches/series     2017-03-06 11:35:39.000000000 
+0100
@@ -5,3 +5,4 @@
 40_fix_browser_hardcoded_paths.patch
 80_remove_phone_home.patch
 90_reproducible_build.patch
+91_lowercase.patch

Reply via email to