Bug 48560 - quotation marks not treated correctly in sender name
Summary: quotation marks not treated correctly in sender name
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: mime (show other bugs)
Version: SVN (3.5 branch)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 50758 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-01 20:02 UTC by Thomas Reitelbach
Modified: 2008-01-19 18:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Reitelbach 2002-10-01 20:02:22 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.95 
OS:          Linux

When the Sender Name containts quotation marks it seems to be not treated correctly.
It's hard for me to explain this, so i made a sreenshot.

To reproduce this, i have done the following:
1. I've changed my own Name to
Thomas "justme" Reitelbach
in the identity settings.
2. I've sent myself a testmail.
3. I checked for new mail (imap)
4. Now my name (the sender name) appears like this: Thomas \"justme\" Reitelbach
5. Now click on the message and it appears like this: Thomas "justme" Reitelbach

Please have a look at the Screenshot:

http://external.erdfunkstelle.de/screenshots/kmail-2002-10-01.jpg

Bye,
Thomas
Comment 1 Thomas Reitelbach 2002-10-01 21:15:30 UTC
i should add what i have found further: 
when i modify my name in the identity dialog and click OK, then - in the   
overview - i can see the quotation marks are beeing escaped by a backslash:   
Thomas \"justme\" Reitelbach   
   
in addition, when i look at the source of my test-message, i can see that   
kmail seemed to have modified simple " into \" in the sender name, so there 
seems to be a bug with the identity dialog, too. 
 
This line is from the Source of my message:  
From: "Thomas \"justme\" Reitelbach" <tr@erdfunkstelle.de> 
 
Of course i did not type the backslashes into the identity dialog :( 
 
Seems something is really buggy here... 
 
Bye, 
Thomas 
Comment 2 Ingo Klöcker 2002-10-02 12:04:33 UTC
The double quotes you entered have to be quoted by prepending a backslash. 
(Well, actually this isn't really necessary. But it doesn't harm either.) 
So this is no bug. The only bug is that in the header view the backslashes 
shouldn't be shown. 
 
Comment 3 Marc Mutz 2002-10-02 19:22:37 UTC
Subject: Re:  quotation marks not treated correctly in sender name

On Wednesday 02 October 2002 12:04, Ingo Kl
Comment 4 Marc Mutz 2003-10-07 15:06:40 UTC
I see you use IMAP. Since KMail retrieves the header information from the IMAP server (which 
parses the addresses), maybe the IMAP server is broken, or - more likely - kio_imap. Can you 
perhaps provide a ethereal log of KMail fetching the header information? 
Comment 5 Thomas Reitelbach 2003-10-10 16:54:44 UTC
Hello Marc, 
 
Below you will find the ethereal log of the _send_ process via SMTP when my 
identity Name is set to Thomas "justme" Reitelbach. 
Please note that KMail already escapes the quotes with a backslash when sending 
such mail. But that seems to be ok since Mozilla does the same. 
 
Furter down you will find the ethereal log when KMail fetches this testmail from my 
imap server. 
 
<<< Ethereal log of SMTP process >>> 
================================= 
220 mail.home-erdfunkstelle.de ESMTP Postfix 
EHLO 172.20.3.21 
250-mail.home-erdfunkstelle.de 
250-PIPELINING 
250-SIZE 104857600 
250-VRFY 
250-ETRN 
250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5 
250 8BITMIME 
AUTH PLAIN 
334  
((my password here)) 
235 Authentication successful 
MAIL FROM:<tr@erdfunkstelle.de> SIZE=403 
RCPT TO:<tr@erdfunkstelle.de> 
DATA 
250 Ok 
250 Ok 
354 End data with <CR><LF>.<CR><LF> 
From: "Thomas \"justme\" Reitelbach" <tr@erdfunkstelle.de> 
To: Thomas Reitelbach <tr@erdfunkstelle.de> 
Subject: Testmail-subject 
Date: Fri, 10 Oct 2003 16:43:25 +0200 
User-Agent: KMail/1.5.9 
MIME-Version: 1.0 
Content-Disposition: inline 
Content-Type: text/plain; 
  charset="us-ascii" 
Content-Transfer-Encoding: 7bit 
Message-Id: <200310101643.27483.tr@erdfunkstelle.de> 
 
Testmail-body 
. 
250 Ok: queued as 09C0A2FB5B 
QUIT 
221 Bye 
 
 
 
 
 
 
<<< Ethereal log of IMAP fetch process >>> 
=================================== 
11867 NOOP 
11867 OK Completed 
11868 UID FETCH 2267 (UID RFC822.HEADER) 
* 4 FETCH (UID 2267 RFC822.HEADER {1111} 
Return-Path: <tr@erdfunkstelle.de> 
Received: from mail.home-erdfunkstelle.de ([unix socket]) 
	by mail.home-erdfunkstelle.de (Cyrus v2.1.15) with LMTP; Fri, 10 Oct 2003 
16:41:05 +0200 
X-Sieve: CMU Sieve 2.2 
Received: by mail.home-erdfunkstelle.de (Postfix, from userid 1003) 
	id 7768A2FB5C; Fri, 10 Oct 2003 16:41:05 +0200 (CEST) 
Received: from 172.20.3.21 (xanathos.hug.de [195.227.92.194]) 
	by mail.home-erdfunkstelle.de (Postfix) with ESMTP id 09C0A2FB5B 
	for <tr@erdfunkstelle.de>; Fri, 10 Oct 2003 16:41:05 +0200 (CEST) 
From: "Thomas \"justme\" Reitelbach" <tr@erdfunkstelle.de> 
To: Thomas Reitelbach <tr@erdfunkstelle.de> 
Subject: Testmail-subject 
Date: Fri, 10 Oct 2003 16:43:25 +0200 
User-Agent: KMail/1.5.9 
MIME-Version: 1.0 
Content-Disposition: inline 
Content-Type: text/plain; 
  charset="us-ascii" 
Content-Transfer-Encoding: 7bit 
Message-Id: <200310101643.27483.tr@erdfunkstelle.de> 
X-Spam-Status: No, hits=-4.7 required=5.0 
	tests=BAYES_10,SUBJ_HAS_UNIQ_ID,USER_AGENT_KMAIL 
	version=2.55 
X-Spam-Level:  
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) 
 
) 
11868 OK Completed 
11869 NOOP 
11869 OK Completed 
11870 UID FETCH 2267 (BODYSTRUCTURE) 
* 4 FETCH (UID 2267 BODYSTRUCTURE ("TEXT" "PLAIN" ("CHARSET" "us-ascii") 
NIL NIL "7BIT" 15 1 NIL ("INLINE" NIL) NIL)) 
11870 OK Completed 
11871 NOOP 
11871 OK Completed 
11872 UID FETCH 2267 (UID BODY[1.MIME]) 
* 4 FETCH (UID 2267 BODY[1.MIME] {1111} 
Return-Path: <tr@erdfunkstelle.de> 
Received: from mail.home-erdfunkstelle.de ([unix socket]) 
	by mail.home-erdfunkstelle.de (Cyrus v2.1.15) with LMTP; Fri, 10 Oct 2003 
16:41:05 +0200 
X-Sieve: CMU Sieve 2.2 
Received: by mail.home-erdfunkstelle.de (Postfix, from userid 1003) 
	id 7768A2FB5C; Fri, 10 Oct 2003 16:41:05 +0200 (CEST) 
Received: from 172.20.3.21 (xanathos.hug.de [195.227.92.194]) 
	by mail.home-erdfunkstelle.de (Postfix) with ESMTP id 09C0A2FB5B 
	for <tr@erdfunkstelle.de>; Fri, 10 Oct 2003 16:41:05 +0200 (CEST) 
From: "Thomas \"justme\" Reitelbach" <tr@erdfunkstelle.de> 
To: Thomas Reitelbach <tr@erdfunkstelle.de> 
Subject: Testmail-subject 
Date: Fri, 10 Oct 2003 16:43:25 +0200 
User-Agent: KMail/1.5.9 
MIME-Version: 1.0 
Content-Disposition: inline 
Content-Type: text/plain; 
  charset="us-ascii" 
Content-Transfer-Encoding: 7bit 
Message-Id: <200310101643.27483.tr@erdfunkstelle.de> 
X-Spam-Status: No, hits=-4.7 required=5.0 
	tests=BAYES_10,SUBJ_HAS_UNIQ_ID,USER_AGENT_KMAIL 
	version=2.55 
X-Spam-Level:  
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) 
 
) 
11872 OK Completed 
11873 NOOP 
11873 OK Completed 
11874 UID FETCH 2267 (UID BODY[1]) 
* 4 FETCH (UID 2267 BODY[1] {15} 
Testmail-body 
) 
11874 OK Completed 
 
 
Hope this helps :-) 
Thomas 
Comment 6 Marc Mutz 2003-10-11 23:36:24 UTC
Thanks for the log, but we need the fetch reponse for "envelope", which is IIRC what KMail uses 
to populate it's message list view. You need to catch the correspondence of kio_imap and the 
server when initially fetching the header information for list display. There's a IMAP "macro" for 
that and it's called ENVVELOPE. That's where the IMAP server actually parses the header fields 
into addresses and that's where I think either your server or kio_imap has problems. The gotcha 
here is that this information is cached by KMail, so either you remove and re-add your IMAP 
account or send yourself a few new messages. 
Comment 7 Ingo Klöcker 2003-10-12 01:09:01 UTC
Subject: Re:  quotation marks not treated correctly in sender name

Can you still reproduce this problem with the latest cvs version of 
KMail? Some time ago I fixed KMMessage::stripEmailAddr, so I expect 
this problem to be resolved.

Comment 8 Thomas Reitelbach 2003-10-13 10:10:42 UTC
Ingo: Yes, i recompiled kdelibs, kdebase and kdepim before i generated the ethereal 
logs, this problem still persists in current HEAD version from a few days ago. 
 
Marc: Ok, i believe i got the correct log now. If this still does not match your needs i 
can provide you with a testaccount on my machine, if you need to. Please contact 
me via private mail then. 
 
<<< Ethereal log of IMAP fetch ENVELOPE process >>>  
 ============================================= 
 
45 NOOP 
* 1 EXISTS 
* 1 RECENT 
45 OK Completed 
46 NOOP 
46 OK Completed 
47 NOOP 
47 OK Completed 
48 UID FETCH 1:* (UID ENVELOPE BODY.PEEK[HEADER.FIELDS 
(REFERENCES)] RFC822.SIZE INTERNALDATE FLAGS) 
* 1 FETCH (FLAGS (\Recent) UID 6 INTERNALDATE "13-Oct-2003 09:44:16 
+0200" RFC822.SIZE 1083 ENVELOPE ("Mon, 13 Oct 2003 09:46:31 +0200" 
"testsubject" (({26} 
Thomas "justme" Reitelbach NIL "tr" "erdfunkstelle.de")) (({26} 
Thomas "justme" Reitelbach NIL "tr" "erdfunkstelle.de")) (({26} 
Thomas "justme" Reitelbach NIL "tr" "erdfunkstelle.de")) ((NIL NIL "test" 
"erdfunkstelle.de")) NIL NIL NIL "<200310130946.44799.tr@erdfunkstelle.de>") 
BODY[HEADER.FIELDS (REFERENCES)] {2} 
 
) 
48 OK Completed 
49 NOOP 
49 OK Completed 
50 UID FETCH 6 (UID RFC822) 
* 1 FETCH (FLAGS (\Recent \Seen) UID 6 RFC822 {1083} 
Return-Path: <tr@erdfunkstelle.de> 
Received: from mail.home-erdfunkstelle.de ([unix socket]) 
	by mail.home-erdfunkstelle.de (Cyrus v2.1.15) with LMTP; Mon, 13 Oct 2003 
09:44:16 +0200 
X-Sieve: CMU Sieve 2.2 
Received: by mail.home-erdfunkstelle.de (Postfix, from userid 1003) 
	id 38EF42FB5E; Mon, 13 Oct 2003 09:44:16 +0200 (CEST) 
Received: from 172.20.3.21 (xanathos.hug.de [195.227.92.194]) 
	by mail.home-erdfunkstelle.de (Postfix) with ESMTP id C4F102FB5D 
	for <test@erdfunkstelle.de>; Mon, 13 Oct 2003 09:44:15 +0200 (CEST) 
From: "Thomas \"justme\" Reitelbach" <tr@erdfunkstelle.de> 
To: test@erdfunkstelle.de 
Subject: testsubject 
Date: Mon, 13 Oct 2003 09:46:31 +0200 
User-Agent: KMail/1.5.9 
MIME-Version: 1.0 
Content-Disposition: inline 
Content-Type: text/plain; 
  charset="us-ascii" 
Content-Transfer-Encoding: 7bit 
Message-Id: <200310130946.44799.tr@erdfunkstelle.de> 
X-Spam-Status: No, hits=-5.7 required=5.0 
	tests=BAYES_00,USER_AGENT_KMAIL 
	version=2.55 
X-Spam-Level:  
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) 
 
testbody 
) 
50 OK Completed 
 
Comment 9 Rafał Rzepecki 2003-10-27 06:10:02 UTC
I'm not using IMAP, but POP3, anyhow I have found similar bug concerning escaped double quotes. 
The problem appears with names formatted as "Foo \"Bar\" Baz" (with quotes; that's exactly how the name appears in headers). In message list this name is rendered as "Foo \" (without quotes), and in message view it is shown as "Foo \"Bar\" Baz" (with quotes). And it stays like this no matter what selecting/clicking magic I do. (At least it's stable, though broken ;-).)

Please let me know if it's related; if it isn't, I'll file a separate bug report.
Comment 10 Thomas Reitelbach 2004-01-02 13:30:52 UTC
I believe bug 50758 is duplicate to this one. 
It's still existing in current CVS, i just added more information how to reproduce to 50758.

BTW: Rafał, i cannot reproduce this using POP3.

Thomas
Comment 11 Rafał Rzepecki 2004-01-02 17:24:51 UTC
Thomas:
An easy way to reproduce the bug I am experiencing, without POP3, IMAP, nothing but KMail:

1. Message -> New message...
2. In "To:" field enter "Foo \"Bar\" Baz" (with quotes).
3. Message -> Save in drafts.
4. Change your folder to drafts.
5. In message list I see "Foo \" (without quotes), whereas in message preview I see "Foo \"Bar\" Baz" (with quotes).

It stays that way no matter of clicking/selecting.
I use KMail 1.5.1 with kdelibs 3.1.4. Also I'm not sure if it's related to this bug; maybe I should file another bugreport, unless it's fixed in newer KMail versions.
Comment 12 Thomas Reitelbach 2004-01-02 17:42:22 UTC
Hi Rafał, what you describe here seems to be definitely fixed already :-)
I cannot reproduce your special scenario with a current version of kmail.

But i still can reproduce the bug when using an imap server.
Comment 13 Rafał Rzepecki 2004-01-02 17:49:12 UTC
That's good thing to read. Looks like it's high time to upgrade :-).

Unfortunately I do not use IMAP at all, so I am unable to help you in fixing your bug. But good luck.
Comment 14 Carsten Burghardt 2004-01-05 02:12:28 UTC
*** Bug 50758 has been marked as a duplicate of this bug. ***
Comment 15 Carsten Burghardt 2004-01-05 02:21:29 UTC
Subject: kdebase/kioslave/imap4

CVS commit by burghard: 

Escape quotes from the imap envelope response so that kmail shows them correctly.
Works with Cyrus- and UW-imap servers.
Courier seems to be broken in this field because it returns a double-backslash instead of a quote:
"Carsten \\test\\ Burghardt"
CCMAIL: 48560-done@bugs.kde.org


  M +1 -1      imapparser.cc   1.58


--- kdebase/kioslave/imap4/imapparser.cc  #1.57:1.58
@@ -622,5 +622,5 @@ mailAddress imapParser::parseAddress (pa
   host = parseLiteral (inWords);
 
-  retVal.setFullNameRaw (QCString(full, full.size() + 1));
+  retVal.setFullName (rfcDecoder::quoteIMAP(QCString(full, full.size() + 1)));
   retVal.setCommentRaw (QCString(comment, comment.size() + 1));
   retVal.setUser (QCString(user, user.size() + 1));


Comment 16 Ingo Klöcker 2008-01-19 18:20:47 UTC
The problem reoccurred with revision 343020 because the double quote character is now quoted twice.
Comment 17 Ingo Klöcker 2008-01-19 18:33:34 UTC
SVN commit 763519 by kloecker:

Do not quote double quotes and backslashes when setting the display name in the mailAddress object. The necessary quoting is applied in mailAddress::getStr() when the email address is composed from its different parts.

BUG: 48560


 M  +1 -1      imapparser.cc  


WebSVN link: http://websvn.kde.org/?view=rev&revision=763519