Changeset 4153 in subversion
- Timestamp:
- Oct 28, 2010 12:35:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_imap_generic.php
r4152 r4153 681 681 } 682 682 683 $message = "INITIAL: $auth_method\n";684 685 683 $result = false; 686 684 … … 738 736 if (!preg_match('/^\* (OK|PREAUTH)/i', $line)) { 739 737 if ($line) 740 $ this->error = sprintf("Wrong startup greeting (%s:%d): %s", $host, $this->prefs['port'], $line);738 $error = sprintf("Wrong startup greeting (%s:%d): %s", $host, $this->prefs['port'], $line); 741 739 else 742 $this->error = sprintf("Empty startup greeting (%s:%d)", $host, $this->prefs['port']); 743 $this->errornum = self::ERROR_BAD; 740 $error = sprintf("Empty startup greeting (%s:%d)", $host, $this->prefs['port']); 741 742 $this->set_error(self::ERROR_BAD, $error); 743 $this->close(); 744 744 return false; 745 745 } … … 750 750 } 751 751 752 $this->message .= $line;752 $this->message = $line; 753 753 754 754 // TLS connection … … 758 758 759 759 if ($res[0] != self::ERROR_OK) { 760 $this->close(); 760 761 return false; 761 762 } … … 763 764 if (!stream_socket_enable_crypto($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { 764 765 $this->set_error(self::ERROR_BAD, "Unable to negotiate TLS"); 766 $this->close(); 765 767 return false; 766 768 } … … 791 793 } 792 794 else { 795 // Prevent from sending credentials in plain text when connection is not secure 796 if ($auth_method == 'LOGIN' && $this->getCapability('LOGINDISABLED')) { 797 $this->set_error(self::ERROR_BAD, "Login disabled by IMAP server"); 798 $this->close(); 799 return false; 800 } 793 801 // replace AUTH with CRAM-MD5 for backward compat. 794 802 $auth_methods[] = $auth_method == 'AUTH' ? 'CRAM-MD5' : $auth_method; … … 830 838 831 839 // Close connection 832 @fclose($this->fp); 833 $this->fp = false; 834 835 return false; 840 $this->close(); 841 842 return false; 836 843 } 837 844 … … 843 850 function close() 844 851 { 845 if ($this-> logged && $this->putLine($this->next_tag() . ' LOGOUT')) {846 if (!feof($this->fp)) 847 fgets($this->fp, 1024); 848 } 852 if ($this->putLine($this->next_tag() . ' LOGOUT')) { 853 $this->readReply(); 854 } 855 849 856 @fclose($this->fp); 850 857 $this->fp = false;
Note: See TracChangeset
for help on using the changeset viewer.
