--- embedaddon/php/ext/soap/soap.c 2012/05/29 12:34:42 1.1.1.2 +++ embedaddon/php/ext/soap/soap.c 2013/07/22 01:32:01 1.1.1.3 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2013 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ | Dmitry Stogov | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.1.1.2 2012/05/29 12:34:42 misho Exp $ */ +/* $Id: soap.c,v 1.1.1.3 2013/07/22 01:32:01 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -463,19 +463,6 @@ zend_module_entry soap_module_entry = { ZEND_GET_MODULE(soap) #endif -ZEND_INI_MH(OnUpdateCacheEnabled) -{ - if (OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) { - return FAILURE; - } - if (SOAP_GLOBAL(cache_enabled)) { - SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode); - } else { - SOAP_GLOBAL(cache) = 0; - } - return SUCCESS; -} - ZEND_INI_MH(OnUpdateCacheMode) { char *p; @@ -489,18 +476,43 @@ ZEND_INI_MH(OnUpdateCacheMode) *p = (char)atoi(new_value); - if (SOAP_GLOBAL(cache_enabled)) { - SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode); - } else { - SOAP_GLOBAL(cache) = 0; + return SUCCESS; +} + +static PHP_INI_MH(OnUpdateCacheDir) +{ + /* Only do the open_basedir check at runtime */ + if (stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) { + char *p; + + if (memchr(new_value, '\0', new_value_length) != NULL) { + return FAILURE; + } + + /* we do not use zend_memrchr() since path can contain ; itself */ + if ((p = strchr(new_value, ';'))) { + char *p2; + p++; + if ((p2 = strchr(p, ';'))) { + p = p2 + 1; + } + } else { + p = new_value; + } + + if (PG(open_basedir) && *p && php_check_open_basedir(p TSRMLS_CC)) { + return FAILURE; + } } + + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); return SUCCESS; } PHP_INI_BEGIN() -STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateCacheEnabled, +STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateBool, cache_enabled, zend_soap_globals, soap_globals) -STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateString, +STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateCacheDir, cache_dir, zend_soap_globals, soap_globals) STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl", "86400", PHP_INI_ALL, OnUpdateLong, cache_ttl, zend_soap_globals, soap_globals) @@ -1102,7 +1114,7 @@ PHP_METHOD(SoapServer, SoapServer) memset(service, 0, sizeof(soapService)); service->send_errors = 1; - cache_wsdl = SOAP_GLOBAL(cache); + cache_wsdl = SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0; if (options != NULL) { HashTable *ht = Z_ARRVAL_P(options); @@ -1657,7 +1669,7 @@ PHP_METHOD(SoapServer, handle) } } #endif - /* If new session or something wierd happned */ + /* If new session or something weird happned */ if (soap_obj == NULL) { zval *tmp_soap; @@ -2318,7 +2330,7 @@ PHP_METHOD(SoapClient, SoapClient) php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null"); } - cache_wsdl = SOAP_GLOBAL(cache); + cache_wsdl = SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0; if (options != NULL) { HashTable *ht = Z_ARRVAL_P(options); @@ -3897,7 +3909,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPt if (version == SOAP_1_1) { if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) { - int new_len; + size_t new_len; xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode")); char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC); xmlAddChild(param, node); @@ -3907,7 +3919,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPt xmlNodeSetContent(node, code); xmlFree(code); } else { - xmlNodeSetContentLen(node, BAD_CAST(str), new_len); + xmlNodeSetContentLen(node, BAD_CAST(str), (int)new_len); } efree(str); } @@ -3922,7 +3934,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPt detail_name = "detail"; } else { if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) { - int new_len; + size_t new_len; xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL); char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC); node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL); @@ -3932,7 +3944,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPt xmlNodeSetContent(node, code); xmlFree(code); } else { - xmlNodeSetContentLen(node, BAD_CAST(str), new_len); + xmlNodeSetContentLen(node, BAD_CAST(str), (int)new_len); } efree(str); }