Re: Search error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 02, 2009 at 06:59:06PM -0700, LuKreme wrote:
> When trying to perform a search (any search) I get:
> 
> ERROR: Could not complete request.
> Query: FETCH (FLAGS UID RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (Date To Cc From Subject X-Priority Importance Priority Content-Type)])
> Reason Given: Error in IMAP command received by server.
> 
> The permission on the user's mailspool are all verified correct.
> 
> squirrelmail-1.4.20.r2_1
> FreeBSD 8.0-RELEASE

I believe that is the same, or very similar, to the error I had.  

That was on squirrelmail 1.4.20-RC2, FreeBSD 8.0-RC2.  My package
version string matches yours.

I think it may have occured because I had the $optional_delimiter
to '.', but I can't remember for certain.  I had carried over the
config.php from our IMAP-UW server when I migrated to our new
Cyrus-IMAPd server.  Most things looked okay, but search was blowing up
and various subfolders were not showing up in the left pane.  I now have
$optional_delimiter set to 'detect'.

Or, I just found were I had patched some functions search uses.  It may
have been fixed by patches to functions/imap* , attached.  I think these
are diffs from 1.4.20-RC2 to the then current SVN version of 1.4.20.

-- 
Scott Lambert                    KC5MLE                       Unix SysAdmin
lambert@xxxxxxxxxxxxxx

diff -ur ./i18n.php /usr/local/www/squirrelmail/functions/i18n.php
--- ./i18n.php	2009-07-28 21:21:06.000000000 -0500
+++ /usr/local/www/squirrelmail/functions/i18n.php	2009-09-11 00:59:36.000000000 -0500
@@ -683,7 +683,8 @@
             $useragent = func_get_arg(2);
             if (strstr($useragent, 'Windows') !== false ||
                 strstr($useragent, 'Mac_') !== false) {
-                $ret = mb_convert_encoding($ret, 'SJIS', 'AUTO');
+                // $ret = mb_convert_encoding($ret, 'SJIS', 'AUTO'); // for Windows 9x clients
+		$ret = mb_convert_encoding($ret, 'UTF-8', 'AUTO'); // for Windows XP/Vista clients
             } else {
                 $ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
 }
diff -ur ./imap_mailbox.php /usr/local/www/squirrelmail/functions/imap_mailbox.php
--- ./imap_mailbox.php	2009-07-28 21:52:32.000000000 -0500
+++ /usr/local/www/squirrelmail/functions/imap_mailbox.php	2009-10-20 22:52:51.000000000 -0500
@@ -755,8 +755,8 @@
             $boxesallbyname[$mailbox] = $g;
             $parentfolder = readMailboxParent($mailbox, $delimiter);
 			/* @FIXME shouldn't use preg_match for simple string matching */
-            if((preg_match('/^inbox'.quotemeta($delimiter).'/i', $mailbox)) ||
-               (preg_match('/^'.$folder_prefix.'/', $mailbox)) ||
+            if((preg_match('|^inbox'.quotemeta($delimiter).'|i', $mailbox)) ||
+               (preg_match('|^'.$folder_prefix.'|', $mailbox)) ||
                ( isset($boxesallbyname[$parentfolder]) && (strlen($parentfolder) > 0) ) ) {
                 if ($dm_count) {
                     $boxes[$g]['formatted']  = str_repeat('  ', $dm_count);
diff -ur ./imap_search.php /usr/local/www/squirrelmail/functions/imap_search.php
--- ./imap_search.php	2009-07-28 21:21:06.000000000 -0500
+++ /usr/local/www/squirrelmail/functions/imap_search.php	2009-10-20 23:05:23.000000000 -0500
@@ -5,9 +5,9 @@
  *
  * 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: imap_search.php 13800 2009-07-29 02:21:06Z pdontthink $
+ * @version $Id: imap_search.php 13850 2009-09-29 12:15:33Z jervfors $
  * @package squirrelmail
  * @subpackage imap
  * @deprecated This search interface has been largely replaced by asearch
@@ -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);
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
-----
squirrelmail-users mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx
List archives: http://news.gmane.org/gmane.mail.squirrelmail.user
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-users

[Index of Archives]     [Video For Linux]     [Yosemite News]     [Yosemite Photos]     [gtk]     [KDE]     [Cyrus SASL]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux