pajoye                                   Sun, 20 Jun 2010 16:33:16 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300617

Log:
- #45808, stream_socket_enable_crypto() blocks and eats CPU

Bug: http://bugs.php.net/45808 (Assigned) [PATCH] stream_socket_enable_crypto() 
blocks and eats CPU
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/openssl/xp_ssl.c
    U   php/php-src/trunk/ext/openssl/xp_ssl.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-06-20 15:37:27 UTC (rev 300616)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-06-20 16:33:16 UTC (rev 300617)
@@ -79,6 +79,8 @@
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)

+- Fixed bug #45808 (stream_socket_enable_crypto() blocks and eats CPU).
+  (vincent at optilian dot com)
 - Fixed bug #52101 (dns_get_record() garbage in 'ipv6' field on Windows).
   (Pierre)
 - Fixed bug #52082 (character_set_client & character_set_connection reset after

Modified: php/php-src/branches/PHP_5_3/ext/openssl/xp_ssl.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/openssl/xp_ssl.c   2010-06-20 15:37:27 UTC 
(rev 300616)
+++ php/php-src/branches/PHP_5_3/ext/openssl/xp_ssl.c   2010-06-20 16:33:16 UTC 
(rev 300617)
@@ -312,8 +312,12 @@
        SSL_METHOD *method;

        if (sslsock->ssl_handle) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS already 
set-up for this stream");
-               return -1;
+               if (sslsock->s.is_blocked) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS 
already set-up for this stream");
+                       return -1;
+               } else {
+                       return 0;
+               }
        }

        /* need to do slightly different things, based on client/server method,
@@ -435,7 +439,8 @@
                        }

                        if (n <= 0) {
-                               retry = handle_ssl_error(stream, n, 1 
TSRMLS_CC);
+                               retry = handle_ssl_error(stream, n, 
sslsock->is_client || sslsock->s.is_blocked TSRMLS_CC);
+
                        } else {
                                break;
                        }

Modified: php/php-src/trunk/ext/openssl/xp_ssl.c
===================================================================
--- php/php-src/trunk/ext/openssl/xp_ssl.c      2010-06-20 15:37:27 UTC (rev 
300616)
+++ php/php-src/trunk/ext/openssl/xp_ssl.c      2010-06-20 16:33:16 UTC (rev 
300617)
@@ -312,8 +312,12 @@
        SSL_METHOD *method;

        if (sslsock->ssl_handle) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS already 
set-up for this stream");
-               return -1;
+               if (sslsock->s.is_blocked) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS 
already set-up for this stream");
+                       return -1;
+               } else {
+                       return 0;
+               }
        }

        /* need to do slightly different things, based on client/server method,
@@ -435,7 +439,8 @@
                        }

                        if (n <= 0) {
-                               retry = handle_ssl_error(stream, n, 1 
TSRMLS_CC);
+                               retry = handle_ssl_error(stream, n, 
sslsock->is_client || sslsock->s.is_blocked TSRMLS_CC);
+
                        } else {
                                break;
                        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to