Bug 392167

Summary: Newlines in MIME parsing cause S/MIME signature to fail
Product: [Applications] kmail2 Reporter: Michał Goliński <ecthelion>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal CC: ecthelion
Priority: NOR    
Version: 5.21.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=332973
Latest Commit: Version Fixed In:
Attachments: A failing email saved form KMail.
The same email when save from thunderbird

Description Michał Goliński 2018-03-22 10:28:08 UTC
KMail mangles newlines in a multipart message. This causes siganture verification to fail.

I believe this is caused by parts in multipart messages that do not end with a newline.

The attached file shows the problem. It is a message that has the following structure:

multipart/signed
    multipart/mixed
        multipart/related
            text/html
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
            image/jpeg
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        application/pdf
    application/pkcs7-signature

KMail adds a newline after the end boundary of multipart/related and before the boundary of multipart/mixed (in the marked place).
Comment 1 Michał Goliński 2018-03-22 10:32:39 UTC
Created attachment 111553 [details]
A failing email saved form KMail.

Note the spurious newline at line 2157.
Comment 2 Michał Goliński 2018-03-22 10:34:08 UTC
Created attachment 111554 [details]
The same email when save from thunderbird

Note that there is no blank line at line 2154
Comment 3 Justin Zobel 2022-11-18 04:30:14 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 4 Michał Goliński 2022-11-18 08:27:49 UTC
Yes, seems to still be the case, exactly as before, saving the same message from inside kmail and from outlook webmail gives extra newlines between mime parts.