Browse Source

Make the use_*_tls options half respect old values. If you leave it as
true, then it would try to use STARTTLS. While I understand this is a
new feature, and this is the dev branch, a little backwards compatibility
is easy in this case. The value 2 is considered true... Using === instead
is an exact match, so you'd have to have 2 in the use_*_tls options for it
to trigger starttls mode.

jangliss 19 years ago
parent
commit
b25a3ff9bf
3 changed files with 7 additions and 4 deletions
  1. 3 0
      ChangeLog
  2. 2 2
      class/deliver/Deliver_SMTP.class.php
  3. 2 2
      functions/imap_general.php

+ 3 - 0
ChangeLog

@@ -9,6 +9,9 @@ Version 1.5.2 - CVS
   - Added "bad plugin" blacklist in configtest.php.
   - Added "bad plugin" blacklist in configtest.php.
   - Fix MagicHTML fix with respect to parsing of u\rl in IE.
   - Fix MagicHTML fix with respect to parsing of u\rl in IE.
   - Added monitored folders option to newmail plugin.
   - Added monitored folders option to newmail plugin.
+  - Tweaked STARTTLS option for SMTP/IMAP to allow previous settings of just
+    pure TLS not to be used to assume STARTTLS.
+  
 	
 	
 Version 1.5.1 (branched on 2006-02-12)
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 --------------------------------------

+ 2 - 2
class/deliver/Deliver_SMTP.class.php

@@ -152,7 +152,7 @@ class Deliver_SMTP extends Deliver {
          * Implementing SMTP STARTTLS (rfc2487) in php 5.1.0+
          * Implementing SMTP STARTTLS (rfc2487) in php 5.1.0+
          * http://www.php.net/stream-socket-enable-crypto
          * http://www.php.net/stream-socket-enable-crypto
          */
          */
-        if ($use_smtp_tls == 2) {
+        if ($use_smtp_tls === 2) {
             if (function_exists('stream_socket_enable_crypto')) {
             if (function_exists('stream_socket_enable_crypto')) {
                 // don't try starting tls, when client thinks that it is already active
                 // don't try starting tls, when client thinks that it is already active
                 if ($this->tls_enabled) {
                 if ($this->tls_enabled) {
@@ -511,4 +511,4 @@ class Deliver_SMTP extends Deliver {
     }
     }
 }
 }
 
 
-?>
+?>

+ 2 - 2
functions/imap_general.php

@@ -673,7 +673,7 @@ function sqimap_create_stream($server,$port,$tls=0) {
      * Implementing IMAP STARTTLS (rfc2595) in php 5.1.0+
      * Implementing IMAP STARTTLS (rfc2595) in php 5.1.0+
      * http://www.php.net/stream-socket-enable-crypto
      * http://www.php.net/stream-socket-enable-crypto
      */
      */
-    if ($tls == 2) {
+    if ($tls === 2) {
         if (function_exists('stream_socket_enable_crypto')) {
         if (function_exists('stream_socket_enable_crypto')) {
             // check starttls capability, don't use cached capability version
             // check starttls capability, don't use cached capability version
             if (! sqimap_capability($imap_stream, 'STARTTLS', false)) {
             if (! sqimap_capability($imap_stream, 'STARTTLS', false)) {
@@ -1291,4 +1291,4 @@ function map_yp_alias($username) {
    return chop(substr($yp, strlen($username)+1));
    return chop(substr($yp, strlen($username)+1));
 }
 }
 
 
-?>
+?>