dmitry Wed Sep 21 10:47:36 2005 EDT
Modified files: (Branch: PHP_5_0)
/php-src/ext/standard basic_functions.c file.c streamsfuncs.c
streamsfuncs.h
Log:
Backport stream_socket_enable_crypto()
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.673.2.19&r2=1.673.2.20&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.673.2.19
php-src/ext/standard/basic_functions.c:1.673.2.20
--- php-src/ext/standard/basic_functions.c:1.673.2.19 Tue Sep 13 09:23:25 2005
+++ php-src/ext/standard/basic_functions.c Wed Sep 21 10:47:28 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.673.2.19 2005/09/13 13:23:25 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.673.2.20 2005/09/21 14:47:28 dmitry Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -588,6 +588,7 @@
PHP_FE(stream_socket_get_name,
NULL)
PHP_FE(stream_socket_recvfrom,
fourth_arg_force_ref)
PHP_FE(stream_socket_sendto,
NULL)
+ PHP_FE(stream_socket_enable_crypto,
NULL)
PHP_FE(stream_copy_to_stream,
NULL)
PHP_FE(stream_get_contents,
NULL)
PHP_FE(fgetcsv,
NULL)
http://cvs.php.net/diff.php/php-src/ext/standard/file.c?r1=1.382.2.9&r2=1.382.2.10&ty=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.382.2.9
php-src/ext/standard/file.c:1.382.2.10
--- php-src/ext/standard/file.c:1.382.2.9 Wed Apr 6 09:59:48 2005
+++ php-src/ext/standard/file.c Wed Sep 21 10:47:31 2005
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.382.2.9 2005/04/06 13:59:48 iliaa Exp $ */
+/* $Id: file.c,v 1.382.2.10 2005/09/21 14:47:31 dmitry Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -208,6 +208,15 @@
REGISTER_LONG_CONSTANT("STREAM_CLIENT_ASYNC_CONNECT",
PHP_STREAM_CLIENT_ASYNC_CONNECT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("STREAM_CLIENT_CONNECT",
PHP_STREAM_CLIENT_CONNECT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_CLIENT",
STREAM_CRYPTO_METHOD_SSLv2_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_CLIENT",
STREAM_CRYPTO_METHOD_SSLv3_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_CLIENT",
STREAM_CRYPTO_METHOD_SSLv23_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_CLIENT",
STREAM_CRYPTO_METHOD_TLS_CLIENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv2_SERVER",
STREAM_CRYPTO_METHOD_SSLv2_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv3_SERVER",
STREAM_CRYPTO_METHOD_SSLv3_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_SSLv23_SERVER",
STREAM_CRYPTO_METHOD_SSLv23_SERVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("STREAM_CRYPTO_METHOD_TLS_SERVER",
STREAM_CRYPTO_METHOD_TLS_SERVER, CONST_CS|CONST_PERSISTENT);
+
REGISTER_LONG_CONSTANT("STREAM_PEEK", STREAM_PEEK, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("STREAM_OOB", STREAM_OOB, CONST_CS |
CONST_PERSISTENT);
http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.35.2.10&r2=1.35.2.11&ty=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.35.2.10
php-src/ext/standard/streamsfuncs.c:1.35.2.11
--- php-src/ext/standard/streamsfuncs.c:1.35.2.10 Fri Jan 14 23:51:03 2005
+++ php-src/ext/standard/streamsfuncs.c Wed Sep 21 10:47:33 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.35.2.10 2005/01/15 04:51:03 sniper Exp $ */
+/* $Id: streamsfuncs.c,v 1.35.2.11 2005/09/21 14:47:33 dmitry Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1196,6 +1196,46 @@
}
/* }}} */
+/* {{{ 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)
+{
+ long cryptokind;
+ 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;
+ }
+
+ php_stream_from_zval(stream, &zstream);
+
+ if (ZEND_NUM_ARGS() >= 3) {
+ if (zsessstream) {
+ php_stream_from_zval(sessstream, &zsessstream);
+ }
+
+ if (php_stream_xport_crypto_setup(stream, cryptokind,
sessstream TSRMLS_CC) < 0) {
+ RETURN_FALSE;
+ }
+ }
+
+ ret = php_stream_xport_crypto_enable(stream, enable TSRMLS_CC);
+ switch (ret) {
+ case -1:
+ RETURN_FALSE;
+
+ case 0:
+ RETURN_LONG(0);
+
+ default:
+ RETURN_TRUE;
+ }
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.h?r1=1.8&r2=1.8.2.1&ty=u
Index: php-src/ext/standard/streamsfuncs.h
diff -u php-src/ext/standard/streamsfuncs.h:1.8
php-src/ext/standard/streamsfuncs.h:1.8.2.1
--- php-src/ext/standard/streamsfuncs.h:1.8 Thu Jan 8 12:32:52 2004
+++ php-src/ext/standard/streamsfuncs.h Wed Sep 21 10:47:33 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.h,v 1.8 2004/01/08 17:32:52 sniper Exp $ */
+/* $Id: streamsfuncs.h,v 1.8.2.1 2005/09/21 14:47:33 dmitry Exp $ */
/* Flags for stream_socket_client */
#define PHP_STREAM_CLIENT_PERSISTENT 1
@@ -49,6 +49,7 @@
PHP_FUNCTION(stream_context_get_options);
PHP_FUNCTION(stream_filter_prepend);
PHP_FUNCTION(stream_filter_append);
+PHP_FUNCTION(stream_socket_enable_crypto);
/*
* Local variables:
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php