Package: squirrelmail
Version: 2:1.4.20~rc2-1
Severity: important
Tags: patch

        There is a bug in the release candidate version of SquirrelMail
currently in Debian.  This bug breaks search capability against Cyrus
2.2 (the Debian version also).

        The bug report on the SM side is at:
---
http://sourceforge.net/tracker/index.php?func=detail&aid=2846511&group_id=311&atid=100311

        The comments of that bug point to a discussion on the mailing
list which includes a patch for this behavior.
---
http://marc.info/?l=squirrelmail-devel&m=125074103915554&w=2

And the patch itself is at:
---
http://netdork.net/imapsearch_fix.patch

        I'm including that patch file in this bug report.  Please
consider including it in the Debian package until this is fixed with a
newer version of upstream.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (650, 'testing'), (600, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages squirrelmail depends on:
ii  apache2-mpm-itk [httpd]  2.2.14-1        multiuser MPM for Apache 2.2
ii  libapache2-mod-php5      5.2.11.dfsg.1-1 server-side, HTML-embedded scripti
ii  perl                     5.10.0-25       Larry Wall's Practical Extraction 
ii  php5                     5.2.11.dfsg.1-1 server-side, HTML-embedded scripti

Versions of packages squirrelmail recommends:
ii  aspell [aspell-bin]    0.60.6-2          GNU Aspell spell-checker
ii  ispell                 3.1.20.0-6        International Ispell (an interacti
ii  php5-mhash             5.2.11.dfsg.1-1   MHASH module for php5
ii  squirrelmail-locales   1.4.18-20090526-1 Translations for the SquirrelMail 
ii  squirrelmail-viewashtm 3.8-2             SquirrelMail plugin: View mails as

Versions of packages squirrelmail suggests:
ii  cyrus-imapd-2.2 [imap-se 2.2.13-16       Cyrus mail system - IMAP support
pn  imapproxy                <none>          (no description available)
ii  php-pear                 5.2.11.dfsg.1-1 PEAR - PHP Extension and Applicati
ii  php5-ldap                5.2.11.dfsg.1-1 LDAP module for php5
ii  php5-recode              5.2.11.dfsg.1-1 recode module for php5
pn  squirrelmail-decode      <none>          (no description available)

-- no debconf information
### Eclipse Workspace Patch 1.0
#P SquirrelMail - Stable
Index: functions/imap_search.php
===================================================================
--- functions/imap_search.php   (revision 13831)
+++ functions/imap_search.php   (working copy)
@@ -46,22 +46,23 @@
        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') {
-                $multi_search_part = mb_convert_encoding($multi_search_part, 
'JIS', 'auto');
-            }
-            $search_string .= $search_where . ' ' .$multi_search_part . ' ';
+    if (strtoupper($languages[$squirrelmail_language]['CHARSET'] == 
'ISO-2022-JP')) {
+        foreach($multi_search as $idx=>$search_part) {
+            $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 {
-        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');
-            }
-            $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
+                );
     }
 
     $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 */
     if (isset($languages[$squirrelmail_language]['CHARSET'])
         && strtolower($result) == 'no') {
         $ss = "SEARCH CHARSET \"US-ASCII\" ALL $search_string";
-        $readin = sqimap_run_command ($imapConnection, $ss, true,
-                                      $result, $message, $uid_support);
+        if (empty($search_lit)) {
+            $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);
+        }
     }
 
     unset($messagelist);

Reply via email to