Bug 439218 - Quoted strings containing comma or brackets are not parsed correctly, causes message sending to fail
Summary: Quoted strings containing comma or brackets are not parsed correctly, causes ...
Status: RESOLVED FIXED
Alias: None
Product: kmime
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: git
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-27 11:54 UTC by Jonathan Marten
Modified: 2021-08-02 11:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.18.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2021-06-27 11:54:08 UTC
SUMMARY

Address parsing does not seem to properly handle quoted strings which contain a comma or parenthesis characters.  If a KMail message is composed which includes such an address, whether typed or in reply to a message which contains addresses formatted such, there is a diagnostic if immediate sending is in use.  However, if the Send Later agent or Undo Send is enabled, the mail is lost.

STEPS TO REPRODUCE

1. Configure KMail for immediate sending and compose a message with an address of the form

  "Foo, Bar" <nobody@mailhost>"

where the actual address within <> can be anything.  The comma can be replaced by an open or close parenthesis.

2. Attempt to send the message.  An error message is displayed, "There were problems trying to queue the message for sending: Message has no recipients"

3. Enable Undo Send and send the message again.  Observe that no error message is displayed.

4.  After the Undo Send time, observe that no message has been received for transmission by the SMTP server and that there are messages in the Akonadi stderr log:

akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: KMime::Message: 
[
 "(message headers and text)"
]

akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: Using transport ( "SMTP:mailhost" , 1503887163 )
akonadi_sendlater_agent(203452)/org.kde.pim.messagecore MessageCore::StringUtil::splitAddressField: Error in address splitting: parseAddressList returned false!
akonadi_sendlater_agent(203452)/kf.coreaddons Kdelibs4Migration::Kdelibs4Migration: Using KDEHOME as the location of the old config file
akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::sendOrQueueMessage: QueueJob started.
...
akonadi_sendlater_agent(203452)/org.kde.pim.messagecomposer MessageComposer::AkonadiSender::queueJobResult: QueueJob failed with error "Message has no recipients."

OBSERVED RESULT

Message is not sent, error messages and log as above.

EXPECTED RESULT

The address should be accepted and the message sent.

SOFTWARE/OS VERSIONS

KMime: Git master (5.17.40)
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Setting severity to major because data loss will occur if the Send Later agent is in used.

According to RFC 5322 section 3.2.4 "Quoted Strings", a quoted string can contain any printable ASCII character apart from quote and backslash (which can be quoted with "\").
Comment 1 Laurent Montel 2021-08-02 04:51:57 UTC
I confirm it.
Comment 2 Laurent Montel 2021-08-02 11:56:23 UTC
Git commit db37d0b2aad768530af408aeef76277e0c0f0976 by Laurent Montel.
Committed on 02/08/2021 at 11:55.
Pushed by mlaurent into branch 'release/21.08'.

Fix Bug 439218 - Quoted strings containing comma or brackets are not parsed correctly, causes message sending to fail
FIXED-IN: 5.18.0

M  +3    -1    messagecomposer/src/helper/messagehelper.cpp

https://invent.kde.org/pim/messagelib/commit/db37d0b2aad768530af408aeef76277e0c0f0976