From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Apr 12 09:40:04 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06F5106564A for ; Sun, 12 Apr 2009 09:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CA9FB8FC1F for ; Sun, 12 Apr 2009 09:40:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n3C9e4fv069143 for ; Sun, 12 Apr 2009 09:40:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n3C9e4V2069142; Sun, 12 Apr 2009 09:40:04 GMT (envelope-from gnats) Resent-Date: Sun, 12 Apr 2009 09:40:04 GMT Resent-Message-Id: <200904120940.n3C9e4V2069142@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kazuo Dohzono Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1532106564A for ; Sun, 12 Apr 2009 09:35:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 954818FC14 for ; Sun, 12 Apr 2009 09:35:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n3C9ZGBH034024 for ; Sun, 12 Apr 2009 09:35:16 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n3C9ZGZm034023; Sun, 12 Apr 2009 09:35:16 GMT (envelope-from nobody) Message-Id: <200904120935.n3C9ZGZm034023@www.freebsd.org> Date: Sun, 12 Apr 2009 09:35:16 GMT From: Kazuo Dohzono To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/133652: [Patch] squirrelmail-1.4.17: non-ascii text handling for "Subject:" field and attached filenames. X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2009 09:40:05 -0000 >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@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: