ports/133652: [Patch] squirrelmail-1.4.17: non-ascii text handling for "Subject:" field and attached filenames.
Kazuo Dohzono
dohzono at gmail.com
Sun Apr 12 09:40:05 UTC 2009
>Number: 133652
>Category: ports
>Synopsis: [Patch] squirrelmail-1.4.17: non-ascii text handling for "Subject:" field and attached filenames.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Apr 12 09:40:04 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Kazuo Dohzono
>Release: 6.4-RELEASE-p1
>Organization:
>Environment:
FreeBSD platinum 6.4-RELEASE-p1 FreeBSD 6.4-RELEASE-p1 #0: Sun Dec 21 08:13:10 UTC 2008
root at i386-builder.daemonology.net:/usr/obj/usr/src/sys/SMP i386
>Description:
There are 2 problems.
1) Subject/filename folding problem.
In some situation, squirrelmail ruins non-ascii text in Subject
field and filenames.
When I write Subject: with ascii and non-ascii text (English and
Japanese, for example), squirrelmail turns them into MIME-encoded
text, and then fold it to 78 colums.
1> Subject: SOME_JAPANESE_TEXT
2> Subject: SOME_MIME_ENCODED_JAPANESE_TEXT_..._LONGER_THAN_78_COLUMNS
3> Subject: SOME_MIME_ENCODED_JAPANESE_TEXT_..._LONGER_THAN_78(carriage return)
3> (tab)_COLUMNS
When mail reader reconizes, 3 would be decoded as:
3'> Subject: SOME_MIME_ENCODED_JAPANESE_TEXT_..._LONGER_THAN_78(single-space)_COLUMNS
and if such single-space is appeared in MIME-encoded-word, most mail
reader can't decode the text.
2) attached filename problem.
When I try to save attached file, Windows browser (firefox3) can't
handle its non-ascii filename correctly.
>How-To-Repeat:
1) Write Subject in ascii/non-ascii combination, and send it to
yourself (in any environment).
2) Write filename in ascii/non-ascii combination, and send it to
yourself, and try to save them (in Japanese-Windows environment).
In both case, you may have to change the combination pattern in order
to reproduce the problem.
>Fix:
Deliver.class.php:
This patch forces squirrelmail not to fold in Subject field and
attached filename. This is not a correct way, though. If you want to
solve this problem,
1) count column with MIME-encoded text length, and
2) separate RAW text (before MIME-encode), and
3) encode separated texts.
Note that some spaces still have to be prepared for MIME-encoded-word
terminators.
i18n.php:
Squirrelmail will treat Japanese filename as UTF-8 (it was SJIS which
was used until Windows-9x). I would like someone to test this with
Macintosh's browser.
*** Deliver.class.php.orig Mon Apr 28 11:18:58 2008
--- Deliver.class.php Sun Apr 12 17:11:32 2009
***************
*** 488,494 ****
--- 488,499 ----
$cnt = count($header);
$hdr_s = '';
for ($i = 0 ; $i < $cnt ; $i++) {
+ // do not fold a line if it contains some name field. e.g. 'filename', 'name'
+ if (strstr($header[$i], 'name') === false) {
$hdr_s .= $this->foldLine($header[$i], 78,str_pad('',4));
+ } else {
+ $hdr_s .= $header[$i];
+ }
}
$header = $hdr_s;
$header .= $rn; /* One blank line to separate mimeheader and body-entity */
***************
*** 719,724 ****
--- 724,730 ----
case 'Cc':
case 'Bcc':
case 'From':
+ case 'Subject':
$hdr_s .= $header[$i];
break;
default: $hdr_s .= $this->foldLine($header[$i], 78, str_pad('',4));
break;
*** i18n.php.orig Tue Oct 28 08:11:38 2008
--- i18n.php Sun Apr 12 17:30:32 2009
***************
*** 638,644 ****
$useragent = func_get_arg(2);
if (strstr($useragent, 'Windows') !== false ||
strstr($useragent, 'Mac_') !== false) {
! $ret = mb_convert_encoding($ret, 'SJIS', 'AUTO');
} else {
$ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
}
--- 638,644 ----
$useragent = func_get_arg(2);
if (strstr($useragent, 'Windows') !== false ||
strstr($useragent, 'Mac_') !== false) {
! $ret = mb_convert_encoding($ret, 'UTF-8', 'AUTO');
} else {
$ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list