[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
scottmacMon Dec 8 11:53:30 2008 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: Fix bug #46748, segfault when SSL has more than one error message. http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.40&r2=1.41&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.40 php-src/ext/openssl/xp_ssl.c:1.41 --- php-src/ext/openssl/xp_ssl.c:1.40 Sun Nov 16 23:03:59 2008 +++ php-src/ext/openssl/xp_ssl.cMon Dec 8 11:53:30 2008 @@ -16,11 +16,12 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.40 2008/11/16 23:03:59 pajoye Exp $ */ +/* $Id: xp_ssl.c,v 1.41 2008/12/08 11:53:30 scottmac Exp $ */ #include "php.h" #include "ext/standard/file.h" #include "streams/php_streams_int.h" +#include "ext/standard/php_smart_str.h" #include "php_network.h" #include "php_openssl.h" #include @@ -89,9 +90,8 @@ php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); char esbuf[512]; - char *ebuf = NULL, *wptr = NULL; - size_t ebuf_size = 0; - unsigned long code, ecode; + smart_str ebuf = {0}; + unsigned long ecode; int retry = 1; switch(err) { @@ -142,35 +142,23 @@ default: do { - /* allow room for a NUL and an optional \n */ - if (ebuf) { - esbuf[0] = '\n'; - esbuf[1] = '\0'; - ERR_error_string_n(ecode, esbuf + 1, sizeof(esbuf) - 2); - } else { - esbuf[0] = '\0'; - ERR_error_string_n(ecode, esbuf, sizeof(esbuf) - 1); + // NULL is automatically added + ERR_error_string_n(ecode, esbuf, sizeof(esbuf)); + if (ebuf.c) { + smart_str_appendc(&ebuf, '\n'); } - code = strlen(esbuf); - esbuf[code] = '\0'; - - ebuf = erealloc(ebuf, ebuf_size + code + 1); - if (wptr == NULL) { - wptr = ebuf; - } - - /* also copies the NUL */ - memcpy(wptr, esbuf, code + 1); - wptr += code; + smart_str_appends(&ebuf, esbuf); } while ((ecode = ERR_get_error()) != 0); + smart_str_0(&ebuf); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL operation failed with code %d. %s%s", err, - ebuf ? "OpenSSL Error messages:\n" : "", - ebuf ? ebuf : ""); - if (ebuf) { - efree(ebuf); + ebuf.c ? "OpenSSL Error messages:\n" : "", + ebuf.c ? ebuf.c : ""); + if (ebuf.c) { + smart_str_free(&ebuf); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /ext/openssl/tests bug46127.pem bug46127.phpt
pajoye Sun Nov 16 23:04:00 2008 UTC Added files: /php-src/ext/openssl/tests bug46127.pem bug46127.phpt Modified files: /php-src/ext/opensslxp_ssl.c Log: - #46127, php_openssl_tcp_sockop_accept forgets to set context on accepted stream http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.39&r2=1.40&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.39 php-src/ext/openssl/xp_ssl.c:1.40 --- php-src/ext/openssl/xp_ssl.c:1.39 Thu Sep 11 23:56:57 2008 +++ php-src/ext/openssl/xp_ssl.cSun Nov 16 23:03:59 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.39 2008/09/11 23:56:57 iliaa Exp $ */ +/* $Id: xp_ssl.c,v 1.40 2008/11/16 23:03:59 pajoye Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -555,6 +555,7 @@ xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+"); if (xparam->outputs.client) { + xparam->outputs.client->context = stream->context; if (stream->context) { zend_list_addref(stream->context->rsrc_id); } http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug46127.pem?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/bug46127.pem +++ php-src/ext/openssl/tests/bug46127.pem -BEGIN CERTIFICATE- MIIC5jCCAk+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBcMQswCQYDVQQGEwJBVTET MBEGA1UECBMKUXVlZW5zbGFuZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQx HDAaBgNVBAMTE1Rlc3QgUENBICgxMDI0IGJpdCkwHhcNOTkxMjAyMjEzNTQ4WhcN MDUwNzExMjEzNTQ4WjBcMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFu ZDEaMBgGA1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxHDAaBgNVBAMTE1Rlc3QgUENB ICgxMDI0IGJpdCkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ2haT/f5Zwy V+MiuSDjSR62adBoSiBB7Usty44lXqsp9RICw+DCCxpsn/CfxPEDXLLd4olsWXc6 JRcxGynbYmnzk+Z6aIPPJQhK3CTvaqGnWKZsA1m+WaUIUqJCuNTK4N+7hMAGaf6S S3e9HVgEQ4a34gXJ7VQFVIBNV1EnZRWHAgMBAAGjgbcwgbQwHQYDVR0OBBYEFE0R aEcrj18q1dw+G6nJbsTWR213MIGEBgNVHSMEfTB7gBRNEWhHK49fKtXcPhupyW7E 1kdtd6FgpF4wXDELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxGjAY BgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRwwGgYDVQQDExNUZXN0IFBDQSAoMTAy NCBiaXQpggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAUa8B3pho +Mvxeq9HsEzJxHIFQla05S5J/e/V+DQTYoKiRFchKPrDAdrzYSEvP3h4QJEtsNqQ JfOxg5M42uLFq7aPGWkF6ZZqZsYS+zA9IVT14g7gNA6Ne+5QtJqQtH9HA24st0T0 Tga/lZ9M2ovImovaxSL/kRHbpCWcqWVxpOw= -END CERTIFICATE- -BEGIN RSA PRIVATE KEY- MIICXAIBAAKBgQCdoWk/3+WcMlfjIrkg40ketmnQaEogQe1LLcuOJV6rKfUSAsPg wgsabJ/wn8TxA1yy3eKJbFl3OiUXMRsp22Jp85PmemiDzyUIStwk72qhp1imbANZ vlmlCFKiQrjUyuDfu4TABmn+kkt3vR1YBEOGt+IFye1UBVSATVdRJ2UVhwIDAQAB AoGAba4fTtuap5l7/8ZsbE7Z1O32KJY4ZcOZukLOLUUhXxXduT+FTgGWujc0/rgc z9qYCLlNZHOouMYTgtSfYvuMuLZ11VIt0GYH+nRioLShE59Yy+zCRyC+gPigS1kz xvo14AsOIPYV14Tk/SsHyq6E0eTk7VzaIE197giiINUERPECQQDSKmtPTh/lRKw7 HSZSM0I1mFWn/1zqrAbontRQY5w98QWIOe5qmzYyFbPXYT3d9BzlsMyhgiRNoBbD yvohSHXJAkEAwAHx6ezAZeWWzD5yXD36nyjpkVCw7Tk7TSmOceLJMWt1QcrCfqlS xA5jjpQ6Z8suU5DdtWAryM2sAir1WisYzwJAd6Zcx56jvAQ3xcPXsE6scBTVFzrj 7FqZ6E+cclPzfLQ+QQsyOBE7bpI6e/FJppY26XGZXo3YGzV8IGXrt40oOQJALETG h86EFXo3qGOFbmsDy4pdP5nBERCu8X1xUCSfintiD4c2DInxgS5oGclnJeMcjTvL QjQoJCX3UJCi/OUO1QJBAKgcDHWjMvt+l1pjJBsSEZ0HX9AAIIVx0RQmbFGS+F2Q hhu5l77WnnZOQ9vvhV5u7NPCUF9nhU3jh60qWWO8mkc= -END RSA PRIVATE KEY- http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/tests/bug46127.phpt?view=markup&rev=1.1 Index: php-src/ext/openssl/tests/bug46127.phpt +++ php-src/ext/openssl/tests/bug46127.phpt --TEST-- openssl_sign/verify: accept different algos --SKIPIF-- --FILE-- false, 'allow_self_signed' => true, 'local_cert' => $pem, // 'passphrase' => '', ); $context = stream_context_create(array('ssl' => $ssl)); $sock = stream_socket_server('ssl://127.0.0.1:'.$port, $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context); if (!$sock) return false; $link = stream_socket_accept($sock); if (!$link) return false; // bad link? fputs($link, "Sending bug 46127\n"); // close stuff fclose($link); fclose($sock); exit; } echo "Running bug46127\n"; $port = rand(15000, 32000); $pid = pcntl_fork(); if ($pid == 0) { // child ssl_server($port); exit; } // client or failed sleep(1); $sock = fsockopen('ssl://127.0.0.1', $port, $errno, $errstr); if (!$sock) exit; echo fgets($sock); pcntl_waitpid($pid, $status); ?> --EXPECTF-- Running bug46127 Sending bug 46127 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
iliaa Thu Sep 11 23:56:58 2008 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: MFB: Fixed bug #45382 (timeout bug in stream_socket_enable_crypto). http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.38&r2=1.39&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.38 php-src/ext/openssl/xp_ssl.c:1.39 --- php-src/ext/openssl/xp_ssl.c:1.38 Fri Jul 11 10:24:29 2008 +++ php-src/ext/openssl/xp_ssl.cThu Sep 11 23:56:57 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.38 2008/07/11 10:24:29 tony2001 Exp $ */ +/* $Id: xp_ssl.c,v 1.39 2008/09/11 23:56:57 iliaa Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -417,7 +417,7 @@ n = SSL_connect(sslsock->ssl_handle); gettimeofday(&tve, &tz); - timeout -= (tve.tv_sec + tve.tv_usec / 100) - (tvs.tv_sec + tvs.tv_usec / 100); + timeout -= (tve.tv_sec + (float) tve.tv_usec / 100) - (tvs.tv_sec + (float) tvs.tv_usec / 100); if (timeout < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL: connection timeout"); return -1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /ext/standard file.c http_fopen_wrapper.c streamsfuncs.c /main/streams streams.c userspace.c xp_socket.c
tony2001Fri Jul 11 10:24:29 2008 UTC Modified files: /php-src/ext/opensslxp_ssl.c /php-src/ext/standard file.c streamsfuncs.c http_fopen_wrapper.c /php-src/main/streams streams.c userspace.c xp_socket.c Log: manage references of stream context properly http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.37&r2=1.38&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.37 php-src/ext/openssl/xp_ssl.c:1.38 --- php-src/ext/openssl/xp_ssl.c:1.37 Mon Apr 14 12:17:38 2008 +++ php-src/ext/openssl/xp_ssl.cFri Jul 11 10:24:29 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.37 2008/04/14 12:17:38 bjori Exp $ */ +/* $Id: xp_ssl.c,v 1.38 2008/07/11 10:24:29 tony2001 Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -555,7 +555,9 @@ xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+"); if (xparam->outputs.client) { - xparam->outputs.client->context = stream->context; + if (stream->context) { + zend_list_addref(stream->context->rsrc_id); + } } } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.519&r2=1.520&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.519 php-src/ext/standard/file.c:1.520 --- php-src/ext/standard/file.c:1.519 Wed May 28 17:24:47 2008 +++ php-src/ext/standard/file.c Fri Jul 11 10:24:29 2008 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.519 2008/05/28 17:24:47 felipe Exp $ */ +/* $Id: file.c,v 1.520 2008/07/11 10:24:29 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1000,10 +1000,6 @@ } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.116&r2=1.117&diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.116 php-src/ext/standard/streamsfuncs.c:1.117 --- php-src/ext/standard/streamsfuncs.c:1.116 Wed May 28 18:02:52 2008 +++ php-src/ext/standard/streamsfuncs.c Fri Jul 11 10:24:29 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.116 2008/05/28 18:02:52 felipe Exp $ */ +/* $Id: streamsfuncs.c,v 1.117 2008/07/11 10:24:29 tony2001 Exp $ */ #include "php.h" #include "php_globals.h" @@ -100,6 +100,10 @@ context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + if (context) { + zend_list_addref(context->rsrc_id); + } + if (flags & PHP_STREAM_CLIENT_PERSISTENT) { spprintf(&hashkey, 0, "stream_socket_client__%s", host); } @@ -156,10 +160,7 @@ } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } + } /* }}} */ @@ -183,6 +184,10 @@ } context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); + + if (context) { + zend_list_addref(context->rsrc_id); + } if (zerrno) { zval_dtor(zerrno); @@ -222,10 +227,6 @@ } php_stream_to_zval(stream, return_value); - - if (zcontext) { - zend_list_addref(Z_RESVAL_P(zcontext)); - } } /* }}} */ @@ -1147,7 +1148,7 @@ FG(default_context) = php_stream_context_alloc(); } context = FG(default_context); - + if (params) { parse_context_options(context, params TSRMLS_CC); } @@ -1177,7 +1178,7 @@ parse_context_params(context, params TSRMLS_CC); } - php_stream_context_to_zval(context, return_value); + RETURN_RESOURCE(context->rsrc_id); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.133&r2=1.134&diff_format=u Index: php-src/ext/standard/http_fopen_wrapper.c diff -u php-src/ext/standard/http_fopen_wrapper.c:1.133 php-src/ext/standard/http_fopen_wrapper.c:1.134 --- php-src/ext/standard/http_fopen_wrapper.c:1.133 Tue Apr 29 08:15:49 2008 +++ php-src/ext/standard/http_fopen_wrapper.c Fri Jul 11 10:24:29 2008 @@ -19,7 +19,7 @@ | Sara Golemon <[EMAIL PROTECTED]> | +
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
bjori Mon Apr 14 12:17:38 2008 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: MFB53: Fixed bug#44716 (Progress notifications incorrect) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.36&r2=1.37&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.36 php-src/ext/openssl/xp_ssl.c:1.37 --- php-src/ext/openssl/xp_ssl.c:1.36 Fri Apr 4 12:49:57 2008 +++ php-src/ext/openssl/xp_ssl.cMon Apr 14 12:17:38 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.36 2008/04/04 12:49:57 jorton Exp $ */ +/* $Id: xp_ssl.c,v 1.37 2008/04/14 12:17:38 bjori Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -198,14 +198,13 @@ break; } } while(retry); - + + if (didwrite > 0) { + php_stream_notify_progress_increment(stream->context, didwrite, 0); + } } else { didwrite = php_stream_socket_ops.write(stream, buf, count TSRMLS_CC); } - - if (didwrite > 0) { - php_stream_notify_progress_increment(stream->context, didwrite, 0); - } if (didwrite < 0) { didwrite = 0; @@ -234,16 +233,16 @@ break; } } while (retry); + + if (nr_bytes > 0) { + php_stream_notify_progress_increment(stream->context, nr_bytes, 0); + } } else { nr_bytes = php_stream_socket_ops.read(stream, buf, count TSRMLS_CC); } - if (nr_bytes > 0) { - php_stream_notify_progress_increment(stream->context, nr_bytes, 0); - } - if (nr_bytes < 0) { nr_bytes = 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
jorton Fri Apr 4 12:49:57 2008 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: Fixed bug #32979 (OpenSSL stream->fd casts broken in 64-bit build) (stotty at tvnet dot hu) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.35&r2=1.36&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.35 php-src/ext/openssl/xp_ssl.c:1.36 --- php-src/ext/openssl/xp_ssl.c:1.35 Mon Dec 31 07:12:12 2007 +++ php-src/ext/openssl/xp_ssl.cFri Apr 4 12:49:57 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.35 2007/12/31 07:12:12 sebastian Exp $ */ +/* $Id: xp_ssl.c,v 1.36 2008/04/04 12:49:57 jorton Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -727,7 +727,7 @@ case PHP_STREAM_AS_FD_FOR_SELECT: if (ret) { - *ret = (void*)sslsock->s.socket; + *(int *)ret = sslsock->s.socket; } return SUCCESS; @@ -737,7 +737,7 @@ return FAILURE; } if (ret) { - *ret = (void*)sslsock->s.socket; + *(int *)ret = sslsock->s.socket; } return SUCCESS; default: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /ext/standard var_unserializer.c var_unserializer.re /sapi/cli php_cli_readline.c
nlopess Sat Sep 29 11:26:51 2007 UTC Modified files: /php-src/ext/opensslxp_ssl.c /php-src/ext/standard var_unserializer.c var_unserializer.re /php-src/sapi/cli php_cli_readline.c Log: MFB: fix compiler warnings http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.33&r2=1.34&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.33 php-src/ext/openssl/xp_ssl.c:1.34 --- php-src/ext/openssl/xp_ssl.c:1.33 Sun May 27 19:13:11 2007 +++ php-src/ext/openssl/xp_ssl.cSat Sep 29 11:26:51 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.33 2007/05/27 19:13:11 tony2001 Exp $ */ +/* $Id: xp_ssl.c,v 1.34 2007/09/29 11:26:51 nlopess Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -464,7 +464,7 @@ "ssl", "peer_certificate", zcert); peer_cert = NULL; - efree(zcert); + FREE_ZVAL(zcert); } if (SUCCESS == php_stream_context_get_option( @@ -490,8 +490,8 @@ zend_list_insert(mycert, php_openssl_get_x509_list_id())); add_next_index_zval(arr, zcert); + FREE_ZVAL(zcert); } - efree(zcert); } else { ZVAL_NULL(arr); } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var_unserializer.c?r1=1.90&r2=1.91&diff_format=u Index: php-src/ext/standard/var_unserializer.c diff -u php-src/ext/standard/var_unserializer.c:1.90 php-src/ext/standard/var_unserializer.c:1.91 --- php-src/ext/standard/var_unserializer.c:1.90Mon Aug 6 18:30:53 2007 +++ php-src/ext/standard/var_unserializer.c Sat Sep 29 11:26:51 2007 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: var_unserializer.c,v 1.90 2007/08/06 18:30:53 jani Exp $ */ +/* $Id: var_unserializer.c,v 1.91 2007/09/29 11:26:51 nlopess Exp $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -388,7 +388,7 @@ } if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, max - (*p)); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); return 0; } http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var_unserializer.re?r1=1.69&r2=1.70&diff_format=u Index: php-src/ext/standard/var_unserializer.re diff -u php-src/ext/standard/var_unserializer.re:1.69 php-src/ext/standard/var_unserializer.re:1.70 --- php-src/ext/standard/var_unserializer.re:1.69 Mon Aug 6 18:25:41 2007 +++ php-src/ext/standard/var_unserializer.reSat Sep 29 11:26:51 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: var_unserializer.re,v 1.69 2007/08/06 18:25:41 jani Exp $ */ +/* $Id: var_unserializer.re,v 1.70 2007/09/29 11:26:51 nlopess Exp $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -392,7 +392,7 @@ } if (datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, max - (*p)); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %ld present", datalen, (long)(max - (*p))); return 0; } http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli_readline.c?r1=1.12&r2=1.13&diff_format=u Index: php-src/sapi/cli/php_cli_readline.c diff -u php-src/sapi/cli/php_cli_readline.c:1.12 php-src/sapi/cli/php_cli_readline.c:1.13 --- php-src/sapi/cli/php_cli_readline.c:1.12Mon Jan 1 09:29:36 2007 +++ php-src/sapi/cli/php_cli_readline.c Sat Sep 29 11:26:51 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_cli_readline.c,v 1.12 2007/01/01 09:29:36 sebastian Exp $ */ +/* $Id: php_cli_readline.c,v 1.13 2007/09/29 11:26:51 nlopess Exp $ */ #include "php.h" @@ -423,7 +423,7 @@ - future: respect scope ("php > function
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
tony2001Sun May 27 19:13:11 2007 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: MFB: fix #41236 (Regression in timeout handling of non-blocking SSL connections during reads and writes). Everybody please calm down, we can always fix such issues without starting a war.. http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.32&r2=1.33&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.32 php-src/ext/openssl/xp_ssl.c:1.33 --- php-src/ext/openssl/xp_ssl.c:1.32 Wed Apr 4 10:44:49 2007 +++ php-src/ext/openssl/xp_ssl.cSun May 27 19:13:11 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.32 2007/04/04 10:44:49 tony2001 Exp $ */ +/* $Id: xp_ssl.c,v 1.33 2007/05/27 19:13:11 tony2001 Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -84,7 +84,7 @@ return 0; } -static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC) +static int handle_ssl_error(php_stream *stream, int nr_bytes, zend_bool is_init TSRMLS_DC) { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; int err = SSL_get_error(sslsock->ssl_handle, nr_bytes); @@ -104,7 +104,7 @@ /* re-negotiation, or perhaps the SSL layer needs more * packets: retry in next iteration */ errno = EAGAIN; - retry = 1; + retry = is_init ? 1 : sslsock->s.is_blocked; break; case SSL_ERROR_SYSCALL: if (ERR_peek_error() == 0) { @@ -193,7 +193,7 @@ didwrite = SSL_write(sslsock->ssl_handle, buf, count); if (didwrite <= 0) { - retry = handle_ssl_error(stream, didwrite TSRMLS_CC); + retry = handle_ssl_error(stream, didwrite, 0 TSRMLS_CC); } else { break; } @@ -226,7 +226,7 @@ nr_bytes = SSL_read(sslsock->ssl_handle, buf, count); if (nr_bytes <= 0) { - retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC); + retry = handle_ssl_error(stream, nr_bytes, 0 TSRMLS_CC); stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); } else { @@ -373,7 +373,7 @@ } if (!SSL_set_fd(sslsock->ssl_handle, sslsock->s.socket)) { - handle_ssl_error(stream, 0 TSRMLS_CC); + handle_ssl_error(stream, 0, 1 TSRMLS_CC); } if (cparam->inputs.session) { @@ -428,7 +428,7 @@ } if (n <= 0) { - retry = handle_ssl_error(stream, n TSRMLS_CC); + retry = handle_ssl_error(stream, n, 1 TSRMLS_CC); } else { break; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
tony2001Wed Apr 4 10:44:49 2007 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: fix leak on error http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.31&r2=1.32&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.31 php-src/ext/openssl/xp_ssl.c:1.32 --- php-src/ext/openssl/xp_ssl.c:1.31 Wed Mar 14 19:21:23 2007 +++ php-src/ext/openssl/xp_ssl.cWed Apr 4 10:44:49 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.31 2007/03/14 19:21:23 tony2001 Exp $ */ +/* $Id: xp_ssl.c,v 1.32 2007/04/04 10:44:49 tony2001 Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -169,6 +169,9 @@ err, ebuf ? "OpenSSL Error messages:\n" : "", ebuf ? ebuf : ""); + if (ebuf) { + efree(ebuf); + } } retry = 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
tony2001Wed Mar 14 19:21:24 2007 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: fix #40750 (openssl stream wrapper ignores default_stream_timeout) http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.30&r2=1.31&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.30 php-src/ext/openssl/xp_ssl.c:1.31 --- php-src/ext/openssl/xp_ssl.c:1.30 Mon Jan 1 09:29:26 2007 +++ php-src/ext/openssl/xp_ssl.cWed Mar 14 19:21:23 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.30 2007/01/01 09:29:26 sebastian Exp $ */ +/* $Id: xp_ssl.c,v 1.31 2007/03/14 19:21:23 tony2001 Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -47,6 +47,7 @@ typedef struct _php_openssl_netstream_data_t { php_netstream_data_t s; SSL *ssl_handle; + struct timeval connect_timeout; int enable_on_connect; int is_client; int ssl_active; @@ -390,7 +391,7 @@ int n, retry = 1; if (cparam->inputs.activate && !sslsock->ssl_active) { - float timeout = sslsock->s.timeout.tv_sec + sslsock->s.timeout.tv_usec / 100; + float timeout = sslsock->connect_timeout.tv_sec + sslsock->connect_timeout.tv_usec / 100; int blocked = sslsock->s.is_blocked; if (!sslsock->state_set) { @@ -607,7 +608,7 @@ tv.tv_sec = FG(default_socket_timeout); tv.tv_usec = 0; } else { - tv = sslsock->s.timeout; + tv = sslsock->connect_timeout; } } else { tv.tv_sec = value; @@ -765,8 +766,13 @@ memset(sslsock, 0, sizeof(*sslsock)); sslsock->s.is_blocked = 1; - sslsock->s.timeout.tv_sec = timeout->tv_sec; - sslsock->s.timeout.tv_usec = timeout->tv_usec; + /* this timeout is used by standard stream funcs, therefor it should use the default value */ + sslsock->s.timeout.tv_sec = FG(default_socket_timeout); + sslsock->s.timeout.tv_usec = 0; + + /* use separate timeout for our private funcs */ + sslsock->connect_timeout.tv_sec = timeout->tv_sec; + sslsock->connect_timeout.tv_usec = timeout->tv_usec; /* we don't know the socket until we have determined if we are binding or * connecting */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /ext/pdo_sqlite/sqlite/src date.c
rrichards Wed Dec 6 13:20:17 2006 UTC Modified files: /php-src/ext/opensslxp_ssl.c /php-src/ext/pdo_sqlite/sqlite/src date.c Log: MFB: Fix win32 build http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.28&r2=1.29&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.28 php-src/ext/openssl/xp_ssl.c:1.29 --- php-src/ext/openssl/xp_ssl.c:1.28 Tue Dec 5 01:39:21 2006 +++ php-src/ext/openssl/xp_ssl.cWed Dec 6 13:20:17 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.28 2006/12/05 01:39:21 iliaa Exp $ */ +/* $Id: xp_ssl.c,v 1.29 2006/12/06 13:20:17 rrichards Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -27,6 +27,10 @@ #include #include +#ifdef PHP_WIN32 +#include "win32/time.h" +#endif + #ifdef NETWARE #include #endif http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite/src/date.c?r1=1.7&r2=1.8&diff_format=u Index: php-src/ext/pdo_sqlite/sqlite/src/date.c diff -u php-src/ext/pdo_sqlite/sqlite/src/date.c:1.7 php-src/ext/pdo_sqlite/sqlite/src/date.c:1.8 --- php-src/ext/pdo_sqlite/sqlite/src/date.c:1.7Thu Nov 30 16:38:53 2006 +++ php-src/ext/pdo_sqlite/sqlite/src/date.cWed Dec 6 13:20:17 2006 @@ -53,7 +53,9 @@ #include #include #include +#ifndef PHP_WIN32 #include "main/php_reentrancy.h" +#endif #ifndef SQLITE_OMIT_DATETIME_FUNCS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
iliaa Tue Dec 5 01:39:21 2006 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: MFB: Fixed bug #39571 (timeout ssl:// connections). http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.27&r2=1.28&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.27 php-src/ext/openssl/xp_ssl.c:1.28 --- php-src/ext/openssl/xp_ssl.c:1.27 Thu Oct 5 00:38:18 2006 +++ php-src/ext/openssl/xp_ssl.cTue Dec 5 01:39:21 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.27 2006/10/05 00:38:18 iliaa Exp $ */ +/* $Id: xp_ssl.c,v 1.28 2006/12/05 01:39:21 iliaa Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -99,7 +99,7 @@ /* re-negotiation, or perhaps the SSL layer needs more * packets: retry in next iteration */ errno = EAGAIN; - retry = sslsock->s.is_blocked; + retry = 1; break; case SSL_ERROR_SYSCALL: if (ERR_peek_error() == 0) { @@ -386,6 +386,9 @@ int n, retry = 1; if (cparam->inputs.activate && !sslsock->ssl_active) { + float timeout = sslsock->s.timeout.tv_sec + sslsock->s.timeout.tv_usec / 100; + int blocked = sslsock->s.is_blocked; + if (!sslsock->state_set) { if (sslsock->is_client) { SSL_set_connect_state(sslsock->ssl_handle); @@ -395,9 +398,23 @@ sslsock->state_set = 1; } + if (sslsock->is_client && SUCCESS == php_set_sock_blocking(sslsock->s.socket, 0 TSRMLS_CC)) { + sslsock->s.is_blocked = 0; + } do { if (sslsock->is_client) { + struct timeval tvs, tve; + struct timezone tz; + + gettimeofday(&tvs, &tz); n = SSL_connect(sslsock->ssl_handle); + gettimeofday(&tve, &tz); + + timeout -= (tve.tv_sec + tve.tv_usec / 100) - (tvs.tv_sec + tvs.tv_usec / 100); + if (timeout < 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL: connection timeout"); + return -1; + } } else { n = SSL_accept(sslsock->ssl_handle); } @@ -409,6 +426,10 @@ } } while (retry); + if (sslsock->is_client && sslsock->s.is_blocked != blocked && SUCCESS == php_set_sock_blocking(sslsock->s.socket, blocked TSRMLS_CC)) { + sslsock->s.is_blocked = blocked; + } + if (n == 1) { X509 *peer_cert; @@ -740,8 +761,8 @@ memset(sslsock, 0, sizeof(*sslsock)); sslsock->s.is_blocked = 1; - sslsock->s.timeout.tv_sec = FG(default_socket_timeout); - sslsock->s.timeout.tv_usec = 0; + sslsock->s.timeout.tv_sec = timeout->tv_sec; + sslsock->s.timeout.tv_usec = timeout->tv_usec; /* we don't know the socket until we have determined if we are binding or * connecting */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
iliaa Thu Oct 5 00:38:18 2006 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: MFB: Fixed bug #39039 (SSL: fatal protocol error when fetching HTTPS from servers running Google web server). http://cvs.php.net/viewvc.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.26&r2=1.27&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.26 php-src/ext/openssl/xp_ssl.c:1.27 --- php-src/ext/openssl/xp_ssl.c:1.26 Fri May 26 01:48:23 2006 +++ php-src/ext/openssl/xp_ssl.cThu Oct 5 00:38:18 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.26 2006/05/26 01:48:23 pajoye Exp $ */ +/* $Id: xp_ssl.c,v 1.27 2006/10/05 00:38:18 iliaa Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -57,17 +57,20 @@ * in an error condition arising from a network connection problem */ static int is_http_stream_talking_to_iis(php_stream *stream TSRMLS_DC) { - if (stream->wrapperdata && stream->wrapper && strcmp(stream->wrapper->wops->label, "HTTP") == 0) { + if (stream->wrapperdata && stream->wrapper && strcasecmp(stream->wrapper->wops->label, "HTTP") == 0) { /* the wrapperdata is an array zval containing the headers */ zval **tmp; #define SERVER_MICROSOFT_IIS "Server: Microsoft-IIS" +#define SERVER_GOOGLE "Server: GFE/" zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream->wrapperdata)); while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(stream->wrapperdata), (void**)&tmp)) { if (strncasecmp(Z_STRVAL_PP(tmp), SERVER_MICROSOFT_IIS, sizeof(SERVER_MICROSOFT_IIS)-1) == 0) { return 1; + } else if (strncasecmp(Z_STRVAL_PP(tmp), SERVER_GOOGLE, sizeof(SERVER_GOOGLE)-1) == 0) { + return 1; } zend_hash_move_forward(Z_ARRVAL_P(stream->wrapperdata)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
pajoye Fri May 26 01:48:23 2006 UTC Modified files: /php-src/ext/opensslxp_ssl.c Log: - MFB: fix leaks in openssl context options http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/xp_ssl.c?r1=1.25&r2=1.26&diff_format=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.25 php-src/ext/openssl/xp_ssl.c:1.26 --- php-src/ext/openssl/xp_ssl.c:1.25 Sun Apr 30 23:45:13 2006 +++ php-src/ext/openssl/xp_ssl.cFri May 26 01:48:23 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.25 2006/04/30 23:45:13 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.26 2006/05/26 01:48:23 pajoye Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -432,6 +432,7 @@ "ssl", "peer_certificate", zcert); peer_cert = NULL; + efree(zcert); } if (SUCCESS == php_stream_context_get_option( @@ -445,7 +446,7 @@ chain = SSL_get_peer_cert_chain( sslsock->ssl_handle); - if (chain) { + if (chain && sk_X509_num(chain) > 0) { int i; array_init(arr); @@ -458,6 +459,7 @@ php_openssl_get_x509_list_id())); add_next_index_zval(arr, zcert); } + efree(zcert); } else { ZVAL_NULL(arr); } @@ -465,6 +467,8 @@ php_stream_context_set_option(stream->context, "ssl", "peer_certificate_chain", arr); + zval_dtor(arr); + efree(arr); } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
dmitry Wed Sep 7 11:34:49 2005 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Fixed memory allocation bug http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.22&r2=1.23&ty=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.22 php-src/ext/openssl/xp_ssl.c:1.23 --- php-src/ext/openssl/xp_ssl.c:1.22 Wed Aug 3 10:07:36 2005 +++ php-src/ext/openssl/xp_ssl.cWed Sep 7 11:34:49 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.22 2005/08/03 14:07:36 sniper Exp $ */ +/* $Id: xp_ssl.c,v 1.23 2005/09/07 15:34:49 dmitry Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -451,7 +451,7 @@ if (clisock >= 0) { php_openssl_netstream_data_t *clisockdata; - clisockdata = pemalloc(sizeof(*clisockdata), stream->is_persistent); + clisockdata = emalloc(sizeof(*clisockdata)); if (clisockdata == NULL) { closesocket(clisock); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /ext/standard streamsfuncs.c
wez Fri Dec 24 21:02:55 2004 EDT Modified files: /php-src/ext/standard streamsfuncs.c /php-src/ext/opensslxp_ssl.c Log: When a socket is non-blocking, don't block ssl enabled sockets. Allow for non-blocking negotiation when calling stream_socket_enable_crypto(). That function will return the foolowing values: false - negotiation failed 0 - try again when more data is available (only for non-blocking sockets) true - ssl was enabled http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.48&r2=1.49&ty=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.48 php-src/ext/standard/streamsfuncs.c:1.49 --- php-src/ext/standard/streamsfuncs.c:1.48Thu Dec 23 14:39:22 2004 +++ php-src/ext/standard/streamsfuncs.c Fri Dec 24 21:02:55 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.48 2004/12/23 19:39:22 wez Exp $ */ +/* $Id: streamsfuncs.c,v 1.49 2004/12/25 02:02:55 wez Exp $ */ #include "php.h" #include "php_globals.h" @@ -1290,7 +1290,7 @@ } /* }}} */ -/* {{{ proto bool stream_socket_enable_crypto(resource stream, bool enable [, int cryptokind, resource sessionstream]) +/* {{{ proto int stream_socket_enable_crypto(resource stream, bool enable [, int cryptokind, resource sessionstream]) Enable or disable a specific kind of crypto on the stream */ PHP_FUNCTION(stream_socket_enable_crypto) { @@ -1298,6 +1298,7 @@ zval *zstream, *zsessstream = NULL; php_stream *stream, *sessstream = NULL; zend_bool enable; + int ret; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|lr", &zstream, &enable, &cryptokind, &zsessstream) == FAILURE) { RETURN_FALSE; @@ -1315,7 +1316,17 @@ } } - RETURN_BOOL(php_stream_xport_crypto_enable(stream, enable TSRMLS_CC) < 0 ? 0 : 1); + ret = php_stream_xport_crypto_enable(stream, enable TSRMLS_CC); + switch (ret) { + case -1: + RETURN_FALSE; + + case 0: + RETURN_LONG(0); + + default: + RETURN_TRUE; + } } /* }}} */ http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.20&r2=1.21&ty=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.20 php-src/ext/openssl/xp_ssl.c:1.21 --- php-src/ext/openssl/xp_ssl.c:1.20 Wed Nov 3 08:12:40 2004 +++ php-src/ext/openssl/xp_ssl.cFri Dec 24 21:02:55 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.20 2004/11/03 13:12:40 jorton Exp $ */ +/* $Id: xp_ssl.c,v 1.21 2004/12/25 02:02:55 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -46,6 +46,8 @@ int is_client; int ssl_active; php_stream_xport_crypt_method_t method; + unsigned state_set:1; + unsigned _spare:31; } php_openssl_netstream_data_t; php_stream_ops php_openssl_socket_ops; @@ -92,6 +94,8 @@ case SSL_ERROR_WANT_WRITE: /* re-negotiation, or perhaps the SSL layer needs more * packets: retry in next iteration */ + errno = EAGAIN; + retry = sslsock->s.is_blocked; break; case SSL_ERROR_SYSCALL: if (ERR_peek_error() == 0) { @@ -159,6 +163,7 @@ } retry = 0; + errno = 0; } return retry; } @@ -210,7 +215,7 @@ if (nr_bytes <= 0) { retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC); - stream->eof = (retry == 0 && !SSL_pending(sslsock->ssl_handle)); + stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); } else { /* we got the data */ @@ -377,10 +382,13 @@ int n, retry = 1; if (cparam->inputs.activate && !sslsock->ssl_active) { - if (sslsock->is_client) { - SSL_set_connect_state(sslsock->ssl_handle); - } else { - SSL_set_accept_state(sslsock->ssl_handle); + if (!sslsock->state_set) { + if (sslsock->is_client) { + SSL_set_connect_state(sslsock->ssl_handle); + } else { + SSL_set_accept_state(sslsock->ssl_handle); + } + sslsock->state_set = 1; } do { @@ -409,6 +4
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
jorton Wed Nov 3 08:12:41 2004 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Remove unused variable. http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.19&r2=1.20&ty=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.19 php-src/ext/openssl/xp_ssl.c:1.20 --- php-src/ext/openssl/xp_ssl.c:1.19 Wed Sep 29 06:28:16 2004 +++ php-src/ext/openssl/xp_ssl.cWed Nov 3 08:12:40 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.19 2004/09/29 10:28:16 hyanantha Exp $ */ +/* $Id: xp_ssl.c,v 1.20 2004/11/03 13:12:40 jorton Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -501,7 +501,6 @@ switch (option) { case PHP_STREAM_OPTION_CHECK_LIVENESS: { - fd_set rfds; struct timeval tv; char buf; int alive = 1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
Shouldn't that be covered by HAVE_SYS_SELECT_H instead? --Wez. On Wed, 29 Sep 2004 10:28:17 -, Anantha Kesari H Y <[EMAIL PROTECTED]> wrote: > hyanantha Wed Sep 29 06:28:17 2004 EDT > > Modified files: > /php-src/ext/opensslxp_ssl.c > Log: > Included select.h for NetWare > > http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.18&r2=1.19&ty=u > Index: php-src/ext/openssl/xp_ssl.c > diff -u php-src/ext/openssl/xp_ssl.c:1.18 php-src/ext/openssl/xp_ssl.c:1.19 > --- php-src/ext/openssl/xp_ssl.c:1.18 Fri Sep 17 08:44:55 2004 > +++ php-src/ext/openssl/xp_ssl.cWed Sep 29 06:28:16 2004 > @@ -16,7 +16,7 @@ >+--+ > */ > > -/* $Id: xp_ssl.c,v 1.18 2004/09/17 12:44:55 wez Exp $ */ > +/* $Id: xp_ssl.c,v 1.19 2004/09/29 10:28:16 hyanantha Exp $ */ > > #include "php.h" > #include "ext/standard/file.h" > @@ -26,6 +26,10 @@ > #include > #include > #include > + > +#ifdef NETWARE > +#include > +#endif > > int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream > TSRMLS_DC); > SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC); > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
hyanantha Wed Sep 29 06:28:17 2004 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Included select.h for NetWare http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.18&r2=1.19&ty=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.18 php-src/ext/openssl/xp_ssl.c:1.19 --- php-src/ext/openssl/xp_ssl.c:1.18 Fri Sep 17 08:44:55 2004 +++ php-src/ext/openssl/xp_ssl.cWed Sep 29 06:28:16 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.18 2004/09/17 12:44:55 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.19 2004/09/29 10:28:16 hyanantha Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -26,6 +26,10 @@ #include #include #include + +#ifdef NETWARE +#include +#endif int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream TSRMLS_DC); SSL *php_SSL_new_from_context(SSL_CTX *ctx, php_stream *stream TSRMLS_DC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
wez Sun May 23 06:35:59 2004 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Finally a fix for #23220: IIS does not cleanly close SSL connections. Also enable the safe and recommended bug work around options in the SSL context. http://cvs.php.net/diff.php/php-src/ext/openssl/xp_ssl.c?r1=1.15&r2=1.16&ty=u Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.15 php-src/ext/openssl/xp_ssl.c:1.16 --- php-src/ext/openssl/xp_ssl.c:1.15 Wed Apr 21 19:02:04 2004 +++ php-src/ext/openssl/xp_ssl.cSun May 23 06:35:58 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.15 2004/04/21 23:02:04 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.16 2004/05/23 10:35:58 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -46,6 +46,29 @@ php_stream_ops php_openssl_socket_ops; +/* it doesn't matter that we do some hash traversal here, since it is done only + * in an error condition arising from a network connection problem */ +static int is_http_stream_talking_to_iis(php_stream *stream TSRMLS_DC) +{ + if (stream->wrapperdata && stream->wrapper && strcmp(stream->wrapper->wops->label, "HTTP") == 0) { + /* the wrapperdata is an array zval containing the headers */ + zval **tmp; + +#define SERVER_MICROSOFT_IIS "Server: Microsoft-IIS" + + zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream->wrapperdata)); + while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(stream->wrapperdata), (void**)&tmp)) { + + if (strncasecmp(Z_STRVAL_PP(tmp), SERVER_MICROSOFT_IIS, sizeof(SERVER_MICROSOFT_IIS)-1) == 0) { + return 1; + } + + zend_hash_move_forward(Z_ARRVAL_P(stream->wrapperdata)); + } + } + return 0; +} + static int handle_ssl_error(php_stream *stream, int nr_bytes TSRMLS_DC) { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; @@ -69,8 +92,11 @@ case SSL_ERROR_SYSCALL: if (ERR_peek_error() == 0) { if (nr_bytes == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "SSL: fatal protocol error"); + if (!is_http_stream_talking_to_iis(stream TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, + "SSL: fatal protocol error"); + } + SSL_set_shutdown(sslsock->ssl_handle, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); stream->eof = 1; retry = 0; } else { @@ -325,6 +351,8 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create an SSL context"); return -1; } + + SSL_CTX_set_options(ctx, SSL_OP_ALL); sslsock->ssl_handle = php_SSL_new_from_context(ctx, stream TSRMLS_CC); if (sslsock->ssl_handle == NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
iliaa Wed Dec 3 10:50:28 2003 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Fixed compiler warning due to unused variables. Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.12 php-src/ext/openssl/xp_ssl.c:1.13 --- php-src/ext/openssl/xp_ssl.c:1.12 Fri Nov 28 18:20:22 2003 +++ php-src/ext/openssl/xp_ssl.cWed Dec 3 10:50:26 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.12 2003/11/28 23:20:22 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.13 2003/12/03 15:50:26 iliaa Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -196,10 +196,11 @@ static int php_openssl_sockop_close(php_stream *stream, int close_handle TSRMLS_DC) { php_openssl_netstream_data_t *sslsock = (php_openssl_netstream_data_t*)stream->abstract; +#ifdef PHP_WIN32 fd_set wrfds, efds; int n; struct timeval timeout; - +#endif if (close_handle) { if (sslsock->ssl_active) { SSL_shutdown(sslsock->ssl_handle); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c /main/streams streams.c xp_socket.c
wez Fri Nov 28 18:20:23 2003 EDT Modified files: /php-src/ext/opensslxp_ssl.c /php-src/main/streams streams.c xp_socket.c Log: (sort of) MFB, feof fix for sockets. Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.11 php-src/ext/openssl/xp_ssl.c:1.12 --- php-src/ext/openssl/xp_ssl.c:1.11 Thu Nov 27 12:40:15 2003 +++ php-src/ext/openssl/xp_ssl.cFri Nov 28 18:20:22 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.11 2003/11/27 17:40:15 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.12 2003/11/28 23:20:22 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -437,10 +437,16 @@ case PHP_STREAM_OPTION_CHECK_LIVENESS: { fd_set rfds; - struct timeval tv = {0,0}; + struct timeval tv; char buf; int alive = 1; + if (sslsock->s.timeout.tv_sec == -1) { + tv.tv_sec = FG(default_socket_timeout); + } else { + tv = sslsock->s.timeout; + } + if (sslsock->s.socket == -1) { alive = 0; } else { Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.41 php-src/main/streams/streams.c:1.42 --- php-src/main/streams/streams.c:1.41 Thu Nov 27 19:00:28 2003 +++ php-src/main/streams/streams.c Fri Nov 28 18:20:23 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: streams.c,v 1.41 2003/11/28 00:00:28 iliaa Exp $ */ +/* $Id: streams.c,v 1.42 2003/11/28 23:20:23 wez Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -602,6 +602,12 @@ return 0; } + if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR == + php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, + 0, NULL)) { + stream->eof = 1; + } + return stream->eof; } @@ -1113,7 +1119,7 @@ break; default: - ret = PHP_STREAM_OPTION_RETURN_ERR; + ; } } Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.16 php-src/main/streams/xp_socket.c:1.17 --- php-src/main/streams/xp_socket.c:1.16 Thu Nov 27 12:39:01 2003 +++ php-src/main/streams/xp_socket.cFri Nov 28 18:20:23 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_socket.c,v 1.16 2003/11/27 17:39:01 wez Exp $ */ +/* $Id: xp_socket.c,v 1.17 2003/11/28 23:20:23 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -203,10 +203,16 @@ case PHP_STREAM_OPTION_CHECK_LIVENESS: { fd_set rfds; - struct timeval tv = {0,0}; + struct timeval tv; char buf; int alive = 1; + if (sock->timeout.tv_sec == -1) { + tv.tv_sec = FG(default_socket_timeout); + } else { + tv = sock->timeout; + } + if (sock->socket == -1) { alive = 0; } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
wez Wed Oct 8 07:23:47 2003 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: And this EOF flag... Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.9 php-src/ext/openssl/xp_ssl.c:1.10 --- php-src/ext/openssl/xp_ssl.c:1.9Sun Sep 21 14:02:07 2003 +++ php-src/ext/openssl/xp_ssl.cWed Oct 8 07:23:46 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.9 2003/09/21 18:02:07 wez Exp $ */ +/* $Id: xp_ssl.c,v 1.10 2003/10/08 11:23:46 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -165,9 +165,8 @@ if (nr_bytes <= 0) { retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC); - if (retry == 0 && !SSL_pending(sslsock->ssl_handle)) { - stream->eof = 1; - } + stream->eof = (retry == 0 && !SSL_pending(sslsock->ssl_handle)); + } else { /* we got the data */ break; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/openssl xp_ssl.c
wez Sun Sep 21 14:02:07 2003 EDT Modified files: /php-src/ext/opensslxp_ssl.c Log: Merge remaining code from 4.3 to fix #22238 in HEAD. Index: php-src/ext/openssl/xp_ssl.c diff -u php-src/ext/openssl/xp_ssl.c:1.8 php-src/ext/openssl/xp_ssl.c:1.9 --- php-src/ext/openssl/xp_ssl.c:1.8Sun Jun 15 19:34:46 2003 +++ php-src/ext/openssl/xp_ssl.cSun Sep 21 14:02:07 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_ssl.c,v 1.8 2003/06/15 23:34:46 edink Exp $ */ +/* $Id: xp_ssl.c,v 1.9 2003/09/21 18:02:07 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -482,6 +482,7 @@ return FAILURE; } return SUCCESS; + case PHP_STREAM_AS_FD_FOR_SELECT: case PHP_STREAM_AS_FD: case PHP_STREAM_AS_SOCKETD: if (sslsock->ssl_active) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php