From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Dec 18 03:00:18 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 108811065694 for ; Fri, 18 Dec 2009 03:00:18 +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 BFF188FC16 for ; Fri, 18 Dec 2009 03:00:17 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBI30HAv030053 for ; Fri, 18 Dec 2009 03:00:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nBI30HPp030052; Fri, 18 Dec 2009 03:00:17 GMT (envelope-from gnats) Resent-Date: Fri, 18 Dec 2009 03:00:17 GMT Resent-Message-Id: <200912180300.nBI30HPp030052@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, Yuri Pankov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A469E1065676; Fri, 18 Dec 2009 02:52:50 +0000 (UTC) (envelope-from yuri.pankov@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mx1.freebsd.org (Postfix) with ESMTP id BFCA68FC1C; Fri, 18 Dec 2009 02:52:49 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id 16so1363446fgg.13 for ; Thu, 17 Dec 2009 18:52:48 -0800 (PST) Received: by 10.87.62.29 with SMTP id p29mr4283539fgk.31.1261102992164; Thu, 17 Dec 2009 18:23:12 -0800 (PST) Received: from darklight.org.ru ([213.132.76.16]) by mx.google.com with ESMTPS id e20sm6349721fga.22.2009.12.17.18.23.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 17 Dec 2009 18:23:11 -0800 (PST) Received: from darklight.org.ru (yuri@darklight.org.ru [127.0.0.1]) by darklight.org.ru (8.14.3/8.14.3) with ESMTP id nBI2N8Pc049266; Fri, 18 Dec 2009 05:23:08 +0300 (MSK) (envelope-from yuri.pankov@gmail.com) Received: (from yuri@localhost) by darklight.org.ru (8.14.3/8.14.3/Submit) id nBI2N8tT049264; Fri, 18 Dec 2009 05:23:08 +0300 (MSK) (envelope-from yuri.pankov@gmail.com) Message-Id: <200912180223.nBI2N8tT049264@darklight.org.ru> Date: Fri, 18 Dec 2009 05:23:08 +0300 (MSK) From: Yuri Pankov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: tabthorpe@FreeBSD.org Subject: ports/141736: [PATCH] mail/squirrelmail: Really fix IMAP search 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: Fri, 18 Dec 2009 03:00:18 -0000 >Number: 141736 >Category: ports >Synopsis: [PATCH] mail/squirrelmail: Really fix IMAP search >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Dec 18 03:00:17 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Yuri Pankov >Release: FreeBSD 9.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD darklight.org.ru 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Wed Dec 16 08:47:03 MSK 2009 >Description: Really fix IMAP search, taken from squirrelmail SVN. Port maintainer (tabthorpe@freebsd.org) is cc'd. Generated with FreeBSD Port Tools 0.99 >How-To-Repeat: >Fix: --- squirrelmail-1.4.20.r2_4.patch begins here --- Index: Makefile =================================================================== RCS file: /home/ncvs/ports/mail/squirrelmail/Makefile,v retrieving revision 1.66 diff -u -r1.66 Makefile --- Makefile 10 Nov 2009 04:10:37 -0000 1.66 +++ Makefile 18 Dec 2009 02:20:53 -0000 @@ -7,7 +7,7 @@ PORTNAME= squirrelmail PORTVERSION= 1.4.20.r2 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= mail www MASTER_SITES= SF/${PORTNAME}/stable/${PORTVERSION:S/.r/-RC/}:squirrelmail \ SF/${PORTNAME}/locales/1.4.18-20090526:locales Index: files/patch-functions__imap_search.php =================================================================== RCS file: /home/ncvs/ports/mail/squirrelmail/files/patch-functions__imap_search.php,v retrieving revision 1.1 diff -u -r1.1 patch-functions__imap_search.php --- files/patch-functions__imap_search.php 10 Nov 2009 04:10:37 -0000 1.1 +++ files/patch-functions__imap_search.php 18 Dec 2009 02:20:53 -0000 @@ -1,9 +1,26 @@ ---- ./functions/imap_search.php.orig 2009-11-09 11:29:39.000000000 -0500 -+++ ./functions/imap_search.php 2009-11-09 11:38:35.000000000 -0500 -@@ -46,22 +46,23 @@ - on the client side, but should be fixed on the server - as per the RFC */ +--- functions/imap_search.php 2009/07/29 02:21:06 13800 ++++ functions/imap_search.php 2009/12/14 21:18:29 13877 +@@ -5,7 +5,7 @@ + * + * IMAP search routines + * +- * @copyright © 1999-2009 The SquirrelMail Project Team ++ * @copyright 1999-2009 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package squirrelmail +@@ -38,30 +38,17 @@ + $multi_search = explode(' ', $search_what); + $search_string = ''; +- /* it seems macosx and hmailserver do not support the prefered search +- syntax so we fall back to the older style. This IMAP +- server has a problem with multiple search terms. Instead +- of returning the messages that match all the terms it +- returns the messages that match each term. Could be fixed +- on the client side, but should be fixed on the server +- as per the RFC */ +- - if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') { - foreach ($multi_search as $multi_search_part) { - if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') { @@ -15,13 +32,7 @@ + $multi_search[$idx] = mb_convert_encoding($search_parth, 'JIS', 'auto'); } } -+ -+ $search_lit = array(); -+ -+ if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') { -+ $search_string .= $search_where . ' ' . implode(' ', $multi_search); -+ } - else { +- else { - foreach ($multi_search as $multi_search_part) { - if (strtoupper($languages[$squirrelmail_language]['CHARSET']) == 'ISO-2022-JP') { - $multi_search_part = mb_convert_encoding($multi_search_part, 'JIS', 'auto'); @@ -29,29 +40,16 @@ - $search_string .= $search_where . ' {' . strlen($multi_search_part) - . "}\r\n" . $multi_search_part . ' '; - } -+ $search_string .= $search_where; -+ $search_lit = array( -+ 'command' => '', -+ 'literal_args' => $multi_search -+ ); ++ ++ foreach ($multi_search as $string) { ++ $search_string .= $search_where ++ . ' "' ++ . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) ++ . '" '; } $search_string = trim($search_string); -@@ -76,15 +77,24 @@ - $ss = "SEARCH ALL $search_string"; - } - -- /* read data back from IMAP */ -- $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, $uid_support); -+ if (empty($search_lit)) { -+ /* read data back from IMAP */ -+ $readin = sqimap_run_command($imapConnection, $ss, false, $result, $message, $uid_support); -+ } else { -+ $search_lit['command'] = $ss; -+ $readin = sqimap_run_literal_command($imapConnection, $search_lit, false, $result, $message, $uid_support); -+ } - - /* try US-ASCII charset if search fails */ +@@ -83,8 +70,12 @@ if (isset($languages[$squirrelmail_language]['CHARSET']) && strtolower($result) == 'no') { $ss = "SEARCH CHARSET \"US-ASCII\" ALL $search_string"; --- squirrelmail-1.4.20.r2_4.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: