Re: Patch for php 5.4.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please do not top-post, thanks.

>>> I'm sorry for bothering you. You are right that it's unrelated.
>>> The subject header is not a printed quotable, but it is base64 encoded
>>> (?UTF-8?B?):
>>> =?UTF-8?B?VsOhOiBSZTogVMOhasOpa296dGF0w7MgUEFDUy1vdCDDqXJpbnTFkQ==IMOhcmFtc3rDvG5ldHLFkWw=?=
>>> If I try to use a base64 decoder, it gives back gibberish.
>>
>> Correct.  As I already told you, the header is malformed.  So then why
>> do you suggest there is a bug in SquirrelMail?
>>
>>> The from header
>>> is also base64 encoded. Using a decoder I can correctly decode that.
>>> Squirrelmail also shows the sender like it should.
>>> Somehow other clients manage to decode it. So there might be some
>>> problem
>>> with the encoding for base64, not just for quoted printable. I don't
>>> know
>>> how I can help you to figure it out.
>>> But it would be good to implement some workaround to display at least
>>> something for the subject to be able to open it.
>
> I don't blame squirrelmail. Agreed, that the header is malformed.

Then you shouldn't have suggested there was a problem in SquirrelMail.
 It's always better to ask instead of suggest someone's code is buggy.

> While
> I'm trying to suggest a workaround I don't mean the bug is in
> squirrelmail. However some sort of workaround (for a bug in another
> application) might be considered, because such messages cannot be opened.
> It wouldn't represent a proper way to deal with the issue.

So have you made an effort to report the bug to the proper place?
Without anyone taking steps to get the problem fixed at its source
while plenty of complaints pour in to those who work on software that
consumes non-compliant data, the result is that you get bloated,
difficult-to-maintain and inefficient code on the wrong end of the
problem.

> But I hate to
> switch to another client just to figure out the malformed subject and the
> contents of the message. Some other clients decode the malformed header
> anyways somehow.

You can try to pull the newest 1.4.23-svn within the next 24 hours.
Please test this FIRST and confirm, if you will, that you can now open
such messages.  Only after you do that, you can try the attached
patch, which is a hack that should display the original string(?).

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php
Index: functions/mime.php
===================================================================
--- functions/mime.php	(revision 14462)
+++ functions/mime.php	(working copy)
@@ -694,6 +694,14 @@
             switch ($encoding)
             {
                 case 'B':
+                    // fix broken base64-encoded strings (remove end = padding,
+                    // change any = to + in middle of string, add padding back
+                    // to the end)
+//FIXME: should we make these extra CPU cycles optional? (create a configuration setting to enable) - after all, such broken strings should not be our responsibility (NB: may be best to create a "compatibility mode" that globally enables workarounds, as having a setting for every broken feature requires too much micro-management... better yet would be to have both)
+                    //if (1) {
+                        $encoded_string_minus_padding = strtr(rtrim($res[4], '='), '=', '+');
+                        $res[4] = str_pad($encoded_string_minus_padding, strlen($res[4]), '=');
+                    //}
                     $replace = base64_decode($res[4]);
                     if ($can_be_encoded) {
                         // string is converted from one charset to another. sanitizing depends on $htmlsave
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
-----
squirrelmail-users mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List archives: http://news.gmane.org/gmane.mail.squirrelmail.user
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux