Date: Fri, 18 Dec 2009 05:23:08 +0300 (MSK) From: Yuri Pankov <yuri.pankov@gmail.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: tabthorpe@FreeBSD.org Subject: ports/141736: [PATCH] mail/squirrelmail: Really fix IMAP search Message-ID: <200912180223.nBI2N8tT049264@darklight.org.ru> Resent-Message-ID: <200912180300.nBI30HPp030052@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912180223.nBI2N8tT049264>