View Issue Details

IDProjectCategoryView StatusLast Update
0003215SOGoWeb Mailpublic2016-04-21 20:42
ReporterJEF Assigned Toludovic  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionsuspended 
Platform[Server] LinuxOSUbuntuOS Version14.04 LTS
Product Version2.2.15 
Summary0003215: MIME decoding not reflect RFC 2047
Description

This part of RFC 2047 is not working is SOGo: "An encoded-word may not be more than 75 characters long, including charset, encoding, encoded text, and delimiters. If it is desirable to encode more text than will fit in an encoded-word of 75 characters, multiple encoded-words (separated by CRLF SPACE) may be used."

SOGo itself place all text of encoded subject and name of attachments to one line in form "=?charset?encoding?encoded text?=", as is in NSData+Mail.m. This is not by RFC, indeed works.

What is not working correctly is other way. When i send mail with MIME separated items to 75 chars separated by CRLF + SPACE (in case of Widnows Live Mail or Outlook it is CRLF + TAB), like this:

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="=?utf-8?Q?The_quick_brown_fox_jumps_over_t?=
=?utf-8?Q?he_lazydog=C4=8C_The_quick_brown_fo?=
=?utf-8?Q?x_jumps_over_the_lazy_dog.xlsx?="

SOGo Webmail includes delimiter character (SPACE or TAB) in file name, like "The quick brown fox jumps over t_he lazy dog ? The quick brown fox jumps over the lazy dog.xlsx". Firefox converts TAB to "", Chrome converts TAB to "%09". Sometimes it brokes file extension and users can't open affected file. When subject is broken, it doesn't look good.

Steps To Reproduce

Use mail client which encode MIME by RFC 2047 (Windows Live Mail, Outlook Express). Send message with any character encoding (UTF-8) in Subject or Attachment for enabling MIME encoding in mail header. Length of Subject or Attachment name must be very long for slit into more lines. Then open this message in SOGo and look at Subject or try to save Attachment for additional spaces or tabs.

TagsNo tags attached.

Activities

JEF

JEF

2015-05-28 13:13

reporter   ~0008542

Found problem in SOPE 2.2.15 (same is in 2.2.17). Here is quick fix, but not 100% in all cases. In file "SOPE/sope-mime/NGMail/NSData+MimeQP.m" comment (or delete) whole ELSE statement on line 119 - 121. Here is edited part from line 112:

      if (bytes[cnt + 1] != '=') {
        buffer[bufLen++] = bytes[cnt];
        buffer[bufLen++] = bytes[cnt+1];
        cnt++;
        if (cnt >= length - 1)
          appendLC = NO;
      }

/ else {
buffer[bufLen++] = bytes[cnt];
}
/

This means, that any character just before "=" outside MIME encoded parts will be discarted. This can affect mails, where is used mixed encoding in subject or attachment name, but it's not so often.

Fixed source file "NSData+MimeQP.m" and compiled "libNGMime.so.4.9.3" on Ubuntu 14.04LTS can be downloaded here http://users.prf.cuni.cz/tester/sope/libNGMime.so.4.9.3.fix.zip .

ludovic

ludovic

2015-05-28 18:34

administrator   ~0008545

I don't have this issue. Can you please retest with a nightly build?

JEF

JEF

2015-06-02 08:52

reporter   ~0008553

Last edited: 2015-06-02 09:09

Tested on Version 2.3.0 (@shiva.inverse 201506020221). Problem still persists. It's highlighted on attached images.

When sending mail from SOGo, it don't split lines of Subject and Filename in header, as required by RFC. In consequency, when MIME encoded subject/filename is on one line, it looks like there is no problem.

JEF

JEF

2015-06-02 08:59

reporter  

Sogo1.png (8,929 bytes)   
Sogo1.png (8,929 bytes)   
JEF

JEF

2015-06-02 09:05

reporter  

Sogo2.png (4,688 bytes)   
Sogo2.png (4,688 bytes)   
JEF

JEF

2015-06-02 09:07

reporter  

Sogo3.png (8,114 bytes)   
Sogo3.png (8,114 bytes)   
ludovic

ludovic

2015-10-23 19:02

administrator   ~0009038

If possible please attach a test mail.

daevidt

daevidt

2015-12-15 10:36

reporter  

Messages.zip (4,518 bytes)
daevidt

daevidt

2015-12-15 10:37

reporter   ~0009209

I can confirm the bug. I've attached an erroneous e-mail.

ludovic

ludovic

2016-04-21 20:42

administrator   ~0010004

This has been fixed a little while ago. Please retest and reopen if necessary. I cannot reproduce it on the latest v3 nightly builds.

Issue History

Date Modified Username Field Change
2015-05-19 13:28 JEF New Issue
2015-05-28 13:13 JEF Note Added: 0008542
2015-05-28 18:34 ludovic Note Added: 0008545
2015-06-02 08:52 JEF Note Added: 0008553
2015-06-02 08:59 JEF File Added: Sogo1.png
2015-06-02 09:05 JEF File Added: Sogo2.png
2015-06-02 09:07 JEF File Added: Sogo3.png
2015-06-02 09:09 JEF Note Edited: 0008553
2015-10-23 19:02 ludovic Note Added: 0009038
2015-12-15 10:36 daevidt File Added: Messages.zip
2015-12-15 10:37 daevidt Note Added: 0009209
2016-04-21 20:42 ludovic Note Added: 0010004
2016-04-21 20:42 ludovic Status new => resolved
2016-04-21 20:42 ludovic Resolution open => suspended
2016-04-21 20:42 ludovic Assigned To => ludovic