6.0.0-beta1
7/24/25

[#292] Horde/IMP handling of literal strings
Summary Horde/IMP handling of literal strings
Queue IMP
Queue Version 3.2.4
Type Bug
State Resolved
Priority 2. Medium
Owners Horde Developers (at)
Requester imp (at) mavetju (dot) org
Created 06/13/2004 (7711 days ago)
Due
Updated 07/24/2004 (7670 days ago)
Assigned 07/18/2004 (7676 days ago)
Resolved 07/24/2004 (7670 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/24/2004 09:15:26 PM imp (at) mavetju (dot) org Comment #12 Reply to this comment
Thank you!
07/24/2004 06:24:49 PM Chuck Hagenbuch State ⇒ Resolved
 
07/18/2004 01:03:44 AM Chuck Hagenbuch Comment #11
Taken from Chuck Hagenbuch
Assigned to Horde DevelopersHorde Developers
Priority ⇒ 2. Medium
State ⇒ Assigned
Reply to this comment
Fine. Go ahead and take care of it, but don't touch anything in HEAD.
07/17/2004 08:47:30 AM Thierry Thomas Assigned to Chuck Hagenbuch
Priority ⇒ 2. Medium
State ⇒ Assigned
 
07/17/2004 08:46:17 AM Thierry Thomas Comment #10
State ⇒ Assigned
Reply to this comment
Removed the state "bogus".



The submitted patch seems correct. Chuck, what do you think about it?
06/14/2004 02:10:10 PM imp (at) mavetju (dot) org Comment #9 Reply to this comment
This fixes it in a beautiful way.



imp-3.2.4/lib/IMP.php.



      * @return string  The correctly quoted and escaped string.

      *

      * @since IMP 3.2.2

      */

     function _rfc822Encode($str, $filter = '')

     {

+        // strip double quotes if they are around the string already.

+        if (substr($str,0,1)=="\"" && substr($str,-1)=="\"")

+            $str=substr($str,1,-1);



         $filter .= 
"()<>@,;:\\\"[]\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20\21\2

2\23\24\25\26\27\30\31\32\33\34\35\36\37\177";



         if (strcspn($str, $filter) != strlen($str)) {





Please add this fix. People who use c-clients (like the imap-uw 
library) which talk to imap servers which do return double quotes 
around addresses if they were in the original email (like dbmail) 
would be happy to be able to use Horde without problems.



Edwin

http://www.mavetju.org/


06/14/2004 01:42:35 PM imp (at) mavetju (dot) org Comment #8 Reply to this comment
In imp-3.2.4/message.php, line 527 and around that line:



/* Don't show addressbook icon on print screen. */

$showIcon = !$printer_friendly;



if (isset($h->date))     $dat = htmlspecialchars(MIME::decode($h->date));

if (isset($h->to))       $to  = buildAddressLinks($h->to, $showIcon);

if (isset($h->from))     $frm = buildAddressLinks($h->from, $showIcon);



$h is filled with information from imap_header().

$h->to is:

     [0] => stdClass Object

         (

             [personal] => "with quotes"

             [mailbox] => edwin

             [host] => barnet.com.au

         )



Are these double quotes around the value of the 'personal' key wrong? 
Should this be without the double quotes? Does IMP expect it without 
the double quotes around it?



After the assignment, $to contains the string '&quot;\&quot;with 
quotes\&quot;&quot; &lt;edwin@barnet.com.au&gt;'. So buildAddressLinks 
somehow escapes the double quotes in the $h->to field.



Please note that I'm not angry with any of you guys. I'm just trying 
to make me see if the values returned by imap_header() are wrong.



Edwin


06/14/2004 01:24:42 PM Chuck Hagenbuch Comment #7 Reply to this comment
Because it's different c-client functions involved. But I'm done with 
this; you asked us for help and have been arguing with our answers 
ever since without actually trying them. This "bug" stays bogus.
06/14/2004 12:53:46 PM imp (at) mavetju (dot) org Comment #6 Reply to this comment
But then, please explain why it is displayed fine in the message 
overview, but it is displayed escaped in the message itself.
06/13/2004 05:10:55 PM chuck (at) horde (dot) org Comment #5 Reply to this comment
Squirrelmail doesn't use PHP's imap functions (thus c-client) so that 
doesn't say anything.
06/13/2004 02:26:45 PM imp (at) mavetju (dot) org Comment #4 Reply to this comment
Sorry for the bad english in the previous comment. Let me try it again.



For what it is worth, can I point you to the difference in what the 
first and the second message returns: The first one (without the 
quotes) returns it as a quoted string (and that goes fine in IMP), the 
second one returns it as a literal string.



It is displayed fine in the message overview, but it is displayed 
escaped in the message itself.



An other IMAP based mailreader (squirrelmail) doesn't display this 
behaviour, which makes me believe it is an IMP issue and not an 
c-client issue.


06/13/2004 02:13:46 PM imp (at) mavetju (dot) org Comment #3 Reply to this comment
Thanks for your reply. Although I don't agree with you yet, I am 
willing to try a different c-client. At this moment I'm using 
cclient-2004, the one from UW. Before that I was using the 2002 version.



For what it is worth, can I point you to the difference in what the 
first and the second message returns: The first one (without the 
quotes) returns it as a quoted string (and that goes fine in IMP), the 
second one returns it as a literal string. It all goes fine and it 
looks good in the message overview, but the moment it is displayed in 
the message itself it is shown.



Edwin


06/13/2004 11:25:20 AM Jan Schneider Comment #2
State ⇒ Not A Bug
Reply to this comment
This is not IMP but your c-client choking on this. Try a different 
c-client compiled with PHP.
06/13/2004 06:16:16 AM imp (at) mavetju (dot) org Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Queue ⇒ IMP
Reply to this comment
imp 3.2.4, horde 2.2.5, PHP 4.3.6



The messages feed to sendmail are:

     From test@mavetju.org  Sun Jun 13 04:45:13 2004

     Return-Path: test@mavetju.org

     To: no quotes <edwin@barnet.com.au>

     Subject: BarNet test - no quotes

     From: no quotes <test@mavetju.org>

     Message-Id: <E1BZDRc-0005l5-75@mavetju.org>

     Date: Sat, 12 Jun 2004 14:41:32 -0400



and

     From test@mavetju.org  Sun Jun 13 04:45:13 2004

     Return-Path: test@mavetju.org

     To: "with quotes" <edwin@barnet.com.au>

     Subject: BarNet test - quotes

     From: "with quotes" <test@mavetju.org>

     Message-Id: <E1BZDRc-0005l5-75@mavetju.org>

     Date: Sat, 12 Jun 2004 14:41:32 -0400



The messages are happily stored in on dbmail mail server. Using

horde/imp to access it, I see this in the message overview

     18 04:41:32 no quotes       BarNet test - no quotes 1kb

     19 04:41:32 "with quotes"   BarNet test - quotes    1kb



The messages themselves shows up as:

     Date:       Sat, 12 Jun 2004 14:41:32 -0400

     From:       no quotes <test@mavetju.org>

     To:         no quotes <edwin@barnet.com.au>

     Subject:    BarNet test - no quotes



And

     Date:       Sat, 12 Jun 2004 14:41:32 -0400

     From:       "\"with quotes\"" <test@mavetju.org>

     To:         "\"with quotes\"" <edwin@barnet.com.au>

     Subject:    BarNet test - quotes



And now the funny thing... this is how the second one shows up with POP3:

     Date:       Sat, 12 Jun 2004 14:41:32 -0400

     From:       with quotes <test@mavetju.org>

     To:         with quotes <edwin@barnet.com.au>

     Subject:    BarNet test - quotes



Fetching the messages manually (issuing the commands that IMP sends),

I get this for the first message:

     a0005 FETCH 18:18 (UID ENVELOPE)

     * 18 FETCH (UID 3388805 ENVELOPE ("Sat, 12 Jun 2004 14:41:32 
-0400" "BarNet

test - no quotes" (("no quotes" NIL "test" "mavetju.org")) (("no quotes" NIL

"test" "mavetju.org")) (("no quotes" NIL "test" "mavetju.org")) (("no quotes"

NIL "edwin" "barnet.com.au")) NIL NIL NIL "<E1BZDRc-0005l5-75@mavetju.org>"))

     a0005 OK FETCH completed



And this for the second message:

     a0005 FETCH 19:19 (UID ENVELOPE)

     * 19 FETCH (UID 3388806 ENVELOPE ("Sat, 12 Jun 2004 14:41:32 
-0400" "BarNet test - quotes" (({13}

     "with quotes" NIL "test" "mavetju.org")) (({13}

     "with quotes" NIL "test" "mavetju.org")) (({13}

     "with quotes" NIL "test" "mavetju.org")) (({13}

     "with quotes" NIL "edwin" "barnet.com.au")) NIL NIL 
NIL"<E1BZDRc-0005l5-75@mavetju.org>"))

     a0005 OK FETCH completed



Other mail readers (mutt / mozilla) don't choke on this.



If you need more information on how to debug this problem, feel

free to contact me via email.


Saved Queries