SM doesn't know how to log in again on the same connection, so best to actually close...
[squirrelmail.git] / functions / imap_general.php
index 718c16b627160c6ed4951ee61fc943f62c4c0f40..34ee573399131c8c79c6e9f657b4e7f3faa90706 100755 (executable)
@@ -5,7 +5,7 @@
  *
  * This implements all functions that do general IMAP functions.
  *
- * @copyright 1999-2014 The SquirrelMail Project Team
+ * @copyright 1999-2017 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -1063,8 +1063,10 @@ function sqimap_login ($username, $password, $imap_server_address,
 function sqimap_logout ($imap_stream) {
     /* Logout is not valid until the server returns 'BYE'
      * If we don't have an imap_ stream we're already logged out */
-    if(isset($imap_stream) && $imap_stream)
+    if(isset($imap_stream) && $imap_stream) {
         sqimap_run_command($imap_stream, 'LOGOUT', false, $response, $message);
+        fclose($imap_stream);
+    }
 }
 
 /**