pajoye Thu Apr 16 13:51:55 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/curl interface.c Log: - improve file:// deactivation in curl_init and do not allow to enable it again manually http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.44&r2=1.62.2.14.2.45&diff_format=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.62.2.14.2.44 php-src/ext/curl/interface.c:1.62.2.14.2.45 --- php-src/ext/curl/interface.c:1.62.2.14.2.44 Thu Apr 16 09:47:33 2009 +++ php-src/ext/curl/interface.c Thu Apr 16 13:51:55 2009 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.62.2.14.2.44 2009/04/16 09:47:33 pajoye Exp $ */ +/* $Id: interface.c,v 1.62.2.14.2.45 2009/04/16 13:51:55 pajoye Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -147,6 +147,7 @@ #endif /* }}} */ +static void _php_curl_close_ex(php_curl *ch TSRMLS_DC); static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC); #define SAVE_CURL_ERROR(__handle, __err) (__handle)->err.no = (int) __err; @@ -1170,6 +1171,7 @@ if (argc > 0) { if (!php_curl_option_url(ch, Z_STRVAL_PP(url), Z_STRLEN_PP(url))) { + _php_curl_close_ex(ch); RETURN_FALSE; } } @@ -1331,6 +1333,13 @@ case CURLOPT_PROTOCOLS: #endif convert_to_long_ex(zvalue); +#if LIBCURL_VERSION_NUM >= 0x71304 + if (((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) && (Z_LVAL_PP(zvalue) & CURLPROTO_FILE)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLPROTO_FILE cannot be activated when in safe_mode or an open_basedir is set"); + RETVAL_FALSE; + return 1; + } +#endif error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue)); break; case CURLOPT_FOLLOWLOCATION: @@ -2011,10 +2020,8 @@ /* {{{ _php_curl_close() List destructor for curl handles */ -static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void _php_curl_close_ex(php_curl *ch TSRMLS_DC) { - php_curl *ch = (php_curl *) rsrc->ptr; - #if PHP_CURL_DEBUG fprintf(stderr, "DTOR CALLED, ch = %x\n", ch); #endif @@ -2053,6 +2060,15 @@ } /* }}} */ +/* {{{ _php_curl_close() + List destructor for curl handles */ +static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC) +{ + php_curl *ch = (php_curl *) rsrc->ptr; + _php_curl_close_ex(ch TSRMLS_CC); +} +/* }}} */ + #endif /* HAVE_CURL */ /*
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php