thomascube
2008-02-08 5bc0ab10fc24d22c422517abd0a9eaa0be31f529
Distinguish ssl and tls for imap connections (#1484667)

3 files modified
11 ■■■■ changed files
program/include/main.inc 2 ●●● patch | view | raw | blame | history
program/include/rcube_imap.inc 6 ●●●● patch | view | raw | blame | history
program/lib/imap.inc 3 ●●●● patch | view | raw | blame | history
program/include/main.inc
@@ -562,7 +562,7 @@
  if ($a_host['host'])
    {
    $host = $a_host['host'];
    $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? TRUE : FALSE;
    $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
    $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : $CONFIG['default_port']);
    }
  else
program/include/rcube_imap.inc
@@ -97,17 +97,17 @@
   * @param  string   Username for IMAP account
   * @param  string   Password for IMAP account
   * @param  number   Port to connect to
   * @param  boolean  Use SSL connection
   * @param  string   SSL schema (either ssl or tls) or null if plain connection
   * @return boolean  TRUE on success, FALSE on failure
   * @access public
   */
  function connect($host, $user, $pass, $port=143, $use_ssl=FALSE)
  function connect($host, $user, $pass, $port=143, $use_ssl=null)
    {
    global $ICL_SSL, $ICL_PORT, $IMAP_USE_INTERNAL_DATE;
    
    // check for Open-SSL support in PHP build
    if ($use_ssl && in_array('openssl', get_loaded_extensions()))
      $ICL_SSL = TRUE;
      $ICL_SSL = $use_ssl == 'imaps' ? 'ssl' : $use_ssl;
    else if ($use_ssl)
      {
      raise_error(array('code' => 403, 'type' => 'imap', 'file' => __FILE__,
program/lib/imap.inc
@@ -49,6 +49,7 @@
        - Sanity check of $message_set in iil_C_FetchHeaders(), iil_C_FetchHeaderIndex(), iil_C_FetchThreadHeaders()
        - Implemented UID FETCH in iil_C_FetchHeaders()
        - Abort do-loop on socket errors (fgets returns false)
        - $ICL_SSL is not boolean anymore but contains the connection schema (ssl or tls)
        - Removed some debuggers (echo ...)
********************************************************/
@@ -455,7 +456,7 @@
    
    //check for SSL
    if ($ICL_SSL) {
        $host = "ssl://".$host;
        $host = $ICL_SSL."://".$host;
    }
    
    //open socket connection