浏览代码

possible fix for unsolicited fetch responses during select call (IA Mail
Server v.5.3 Corporate Edition

stekkel 19 年之前
父节点
当前提交
ac5f37ba81
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      functions/imap_general.php

+ 7 - 1
functions/imap_general.php

@@ -392,6 +392,12 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
     $aResponse = '';
     $aResponse = '';
     $resultlist = array();
     $resultlist = array();
     $data = array();
     $data = array();
+    $sCommand = '';
+    if (preg_match("/^(\w+)\s*/",$query,$aMatch)) {
+        $sCommand = strtoupper($aMatch[1]);
+    } else {
+        // error reporting (shouldn't happen)
+    }
     $read = sqimap_fgets($imap_stream);
     $read = sqimap_fgets($imap_stream);
     $i = 0;
     $i = 0;
     while ($read) {
     while ($read) {
@@ -455,7 +461,7 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
 
 
           case '*':
           case '*':
           {
           {
-            if (preg_match('/^\*\s\d+\sFETCH/',$read)) {
+            if ($sCommand == "FETCH" && preg_match('/^\*\s\d+\sFETCH/',$read)) {
                 /* check for literal */
                 /* check for literal */
                 $s = substr($read,-3);
                 $s = substr($read,-3);
                 $fetch_data = array();
                 $fetch_data = array();