[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c
moriyoshiWed, 20 Jul 2011 04:34:01 + Revision: http://svn.php.net/viewvc?view=revision&revision=313464 Log: - Fixed bug #55073 (PHP-CLI-webserver does not listen on ipv6 interfaces), letting getaddrinfo(3) validate IPv6 addresses. Bug: https://bugs.php.net/55073 (Assigned) PHP-CLI-webserver does not listen on ipv6 interfaces Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c U php/php-src/trunk/sapi/cli/php_cli_server.c Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c === --- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-20 03:11:53 UTC (rev 313463) +++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-20 04:34:01 UTC (rev 313464) @@ -1806,19 +1806,35 @@ int port = 3000; php_socket_t server_sock = SOCK_ERR; - host = pestrdup(addr, 1); - if (!host || *host == ':' ) { - if (host) { - pefree(host, 1); + if (addr[0] == '[') { + char *p; + host = pestrdup(addr + 1, 1); + if (!host) { + return FAILURE; } - fprintf(stderr, "Invalid built-in web-server addr:port argument\n"); - return FAILURE; - } - - { - char *p = strchr(host, ':'); + p = strchr(host, ']'); if (p) { *p++ = '\0'; + if (*p == ':') { + port = strtol(p + 1, &p, 10); + } else if (*p != '\0') { + p = NULL; + } + } + if (!p) { + fprintf(stderr, "Invalid IPv6 address: %s\n", host); + retval = FAILURE; + goto out; + } + } else { + char *p; + host = pestrdup(addr, 1); + if (!host) { + return FAILURE; + } + p = strrchr(host, ':'); + if (p) { + *p++ = '\0'; port = strtol(p, &p, 10); } } @@ -2106,7 +2122,7 @@ } sapi_module.phpinfo_as_text = 0; - printf("PHP Development Server is listening on %s:%d in %s ... Press Ctrl-C to quit.\n", server.host, server.port, document_root); + printf("PHP Development Server is listening on %s in %s ... Press Ctrl-C to quit.\n", server_bind_address, document_root); #if defined(HAVE_SIGNAL_H) && defined(SIGINT) signal(SIGINT, php_cli_server_sigint_handler); Modified: php/php-src/trunk/sapi/cli/php_cli_server.c === --- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-20 03:11:53 UTC (rev 313463) +++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-20 04:34:01 UTC (rev 313464) @@ -1806,19 +1806,35 @@ int port = 3000; php_socket_t server_sock = SOCK_ERR; - host = pestrdup(addr, 1); - if (!host || *host == ':' ) { - if (host) { - pefree(host, 1); + if (addr[0] == '[') { + char *p; + host = pestrdup(addr + 1, 1); + if (!host) { + return FAILURE; } - fprintf(stderr, "Invalid built-in web-server addr:port argument\n"); - return FAILURE; - } - - { - char *p = strchr(host, ':'); + p = strchr(host, ']'); if (p) { *p++ = '\0'; + if (*p == ':') { + port = strtol(p + 1, &p, 10); + } else if (*p != '\0') { + p = NULL; + } + } + if (!p) { + fprintf(stderr, "Invalid IPv6 address: %s\n", host); + retval = FAILURE; + goto out; + } + } else { + char *p; + host = pestrdup(addr, 1); + if (!host) { + return FAILURE; + } + p = strrchr(host, ':'); + if (p) { + *p++ = '\0'; port = strtol(p, &p, 10); } } @@ -2106,7 +2122,7 @@ } sapi_module.phpinfo_as_text = 0; - printf("PHP Development Server is listening on %s:%d in %s ... Press Ctrl-C to quit.\n", server.host, server.port, document_root); + printf("PHP Development Server is listening on %s in %s ... Press Ctrl-C to quit.\n", server_bind_address, document_root); #if defined(HAVE_SIGNAL_H) && defined(SIGINT) signal(SIGINT, php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
On Wed, Jul 20, 2011 at 1:50 AM, Scott MacVicar wrote: > OpenSSL has been FIPS certified, your change has changed this contract and > it's calling back into a Windows API. Has it been reviewed for correctness? And by the way, the CryptoAPI for the windows versions we support is certified as well. Just in case you did not check yourself in the 1st place. Furter ref, http://technet.microsoft.com/en-us/library/cc750357.aspx Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
hi, On Wed, Jul 20, 2011 at 1:50 AM, Scott MacVicar wrote: > Why did you even commit such a change without discussing it? I maintain this part of the OpenSsl extension and the php windows port. There was a horrible bug and slowdown with this code and I fixed it. Users tested it and are happy with the fix. > I understand your logic for doing this but there was no RFC or discussion > around the impact of this. I do not need to do a RFC for a fix and even less for an extension I maintain. > OpenSSL has been FIPS certified, your change has changed this contract and > it's calling back into a Windows API. Has it been reviewed for correctness? Be serious two and half second. I gave you the explanation in my reply. > Whats the speed difference between OpenSSL and your version. I know you > removed the screen code which was causing a long delay. 300% Now move on, we have other things to do that arguing about this little broken function introduced back then. > > On Jul 19, 2011, at 4:13 PM, Pierre Joye wrote: > >> Why did you not ask in the 1st place before reverting it? >> >> Please don't waste our time with such things. Users expect this >> (tested) fix in the next releases. >> >> Now, openssl has lower minimum windows version support that we do, and >> does all possible things to improve the entropy, which is not required >> nor necessary for the windows we support. >> >> The idea in the 1st place was to have a standard set of random >> functions instead of this, as you well know. Now it is too late and we >> have to live with this function. While the set of random will surely >> come at some point too. >> >> On Wed, Jul 20, 2011 at 1:04 AM, Scott MacVicar wrote: >>> Why isn't this fixed upstream? This is a horrible idea to make core changes >>> like this without a discussion. >>> >>> I'll revert this again so we can at least have the opportunity to discuss >>> this. >>> >>> S >>> >>> On 19 Jul 2011, at 15:55, Pierre Joye wrote: >>> Please restore that, now. That's not your cup of tea and it is the way it should have been in the 1st place. On Wed, Jul 20, 2011 at 12:29 AM, Scott MacVicar wrote: > scottmac Tue, 19 Jul 2011 22:29:55 + > > Revision: http://svn.php.net/viewvc?view=revision&revision=313455 > > Log: > Revert change to use a special Windows version of > openssl_random_pseudo_bytes(). > > Lets discuss this on internals first. We're advertising something from > the OpenSSL library > and then subverting it with another Windows OS call. > > What are the implications of this? Should we make this available in > ext/standard/ instead? > > Changed paths: > U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c > U php/php-src/trunk/ext/openssl/openssl.c > > Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c > === > --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 > 22:18:08 UTC (rev 313454) > +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 > 22:29:55 UTC (rev 313455) > @@ -4930,19 +4930,10 @@ > > buffer = emalloc(buffer_length + 1); > > -#ifdef PHP_WIN32 > - strong_result = 1; > - /* random/urandom equivalent on Windows */ > - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == > FAILURE){ > - efree(buffer); > - RETURN_FALSE; > - } > -#else > if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < > 0) { > efree(buffer); > RETURN_FALSE; > } > -#endif > > buffer[buffer_length] = 0; > RETVAL_STRINGL((char *)buffer, buffer_length, 0); > > Modified: php/php-src/trunk/ext/openssl/openssl.c > === > --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC > (rev 313454) > +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC > (rev 313455) > @@ -4926,19 +4926,10 @@ > > buffer = emalloc(buffer_length + 1); > > -#ifdef PHP_WIN32 > - strong_result = 1; > - /* random/urandom equivalent on Windows */ > - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == > FAILURE){ > - efree(buffer); > - RETURN_FALSE; > - } > -#else > if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < > 0) { > efree(buffer); > RETURN_FALSE; > } > -#endif > > buffer[buffer_length] = 0; > RETVAL_STRINGL((char *)buffer, buffer_length, 0); > > > -- > PHP CVS Mailing
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
Why did you even commit such a change without discussing it? I understand your logic for doing this but there was no RFC or discussion around the impact of this. OpenSSL has been FIPS certified, your change has changed this contract and it's calling back into a Windows API. Has it been reviewed for correctness? Whats the speed difference between OpenSSL and your version. I know you removed the screen code which was causing a long delay. On Jul 19, 2011, at 4:13 PM, Pierre Joye wrote: > Why did you not ask in the 1st place before reverting it? > > Please don't waste our time with such things. Users expect this > (tested) fix in the next releases. > > Now, openssl has lower minimum windows version support that we do, and > does all possible things to improve the entropy, which is not required > nor necessary for the windows we support. > > The idea in the 1st place was to have a standard set of random > functions instead of this, as you well know. Now it is too late and we > have to live with this function. While the set of random will surely > come at some point too. > > On Wed, Jul 20, 2011 at 1:04 AM, Scott MacVicar wrote: >> Why isn't this fixed upstream? This is a horrible idea to make core changes >> like this without a discussion. >> >> I'll revert this again so we can at least have the opportunity to discuss >> this. >> >> S >> >> On 19 Jul 2011, at 15:55, Pierre Joye wrote: >> >>> Please restore that, now. That's not your cup of tea and it is the way >>> it should have been in the 1st place. >>> >>> On Wed, Jul 20, 2011 at 12:29 AM, Scott MacVicar wrote: scottmac Tue, 19 Jul 2011 22:29:55 + Revision: http://svn.php.net/viewvc?view=revision&revision=313455 Log: Revert change to use a special Windows version of openssl_random_pseudo_bytes(). Lets discuss this on internals first. We're advertising something from the OpenSSL library and then subverting it with another Windows OS call. What are the implications of this? Should we make this available in ext/standard/ instead? Changed paths: U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c U php/php-src/trunk/ext/openssl/openssl.c Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c === --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev 313454) +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev 313455) @@ -4930,19 +4930,10 @@ buffer = emalloc(buffer_length + 1); -#ifdef PHP_WIN32 - strong_result = 1; - /* random/urandom equivalent on Windows */ - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ - efree(buffer); - RETURN_FALSE; - } -#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } -#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); Modified: php/php-src/trunk/ext/openssl/openssl.c === --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev 313454) +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev 313455) @@ -4926,19 +4926,10 @@ buffer = emalloc(buffer_length + 1); -#ifdef PHP_WIN32 - strong_result = 1; - /* random/urandom equivalent on Windows */ - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ - efree(buffer); - RETURN_FALSE; - } -#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } -#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> >>> -- >>> Pierre >>> >>> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >> > > > > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
Why did you not ask in the 1st place before reverting it? Please don't waste our time with such things. Users expect this (tested) fix in the next releases. Now, openssl has lower minimum windows version support that we do, and does all possible things to improve the entropy, which is not required nor necessary for the windows we support. The idea in the 1st place was to have a standard set of random functions instead of this, as you well know. Now it is too late and we have to live with this function. While the set of random will surely come at some point too. On Wed, Jul 20, 2011 at 1:04 AM, Scott MacVicar wrote: > Why isn't this fixed upstream? This is a horrible idea to make core changes > like this without a discussion. > > I'll revert this again so we can at least have the opportunity to discuss > this. > > S > > On 19 Jul 2011, at 15:55, Pierre Joye wrote: > >> Please restore that, now. That's not your cup of tea and it is the way >> it should have been in the 1st place. >> >> On Wed, Jul 20, 2011 at 12:29 AM, Scott MacVicar wrote: >>> scottmac Tue, 19 Jul 2011 22:29:55 + >>> >>> Revision: http://svn.php.net/viewvc?view=revision&revision=313455 >>> >>> Log: >>> Revert change to use a special Windows version of >>> openssl_random_pseudo_bytes(). >>> >>> Lets discuss this on internals first. We're advertising something from the >>> OpenSSL library >>> and then subverting it with another Windows OS call. >>> >>> What are the implications of this? Should we make this available in >>> ext/standard/ instead? >>> >>> Changed paths: >>> U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c >>> U php/php-src/trunk/ext/openssl/openssl.c >>> >>> Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c >>> === >>> --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:18:08 >>> UTC (rev 313454) >>> +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:29:55 >>> UTC (rev 313455) >>> @@ -4930,19 +4930,10 @@ >>> >>> buffer = emalloc(buffer_length + 1); >>> >>> -#ifdef PHP_WIN32 >>> - strong_result = 1; >>> - /* random/urandom equivalent on Windows */ >>> - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == >>> FAILURE){ >>> - efree(buffer); >>> - RETURN_FALSE; >>> - } >>> -#else >>> if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { >>> efree(buffer); >>> RETURN_FALSE; >>> } >>> -#endif >>> >>> buffer[buffer_length] = 0; >>> RETVAL_STRINGL((char *)buffer, buffer_length, 0); >>> >>> Modified: php/php-src/trunk/ext/openssl/openssl.c >>> === >>> --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC >>> (rev 313454) >>> +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC >>> (rev 313455) >>> @@ -4926,19 +4926,10 @@ >>> >>> buffer = emalloc(buffer_length + 1); >>> >>> -#ifdef PHP_WIN32 >>> - strong_result = 1; >>> - /* random/urandom equivalent on Windows */ >>> - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == >>> FAILURE){ >>> - efree(buffer); >>> - RETURN_FALSE; >>> - } >>> -#else >>> if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { >>> efree(buffer); >>> RETURN_FALSE; >>> } >>> -#endif >>> >>> buffer[buffer_length] = 0; >>> RETVAL_STRINGL((char *)buffer, buffer_length, 0); >>> >>> >>> -- >>> PHP CVS Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> >> -- >> Pierre >> >> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org > -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
Why isn't this fixed upstream? This is a horrible idea to make core changes like this without a discussion. I'll revert this again so we can at least have the opportunity to discuss this. S On 19 Jul 2011, at 15:55, Pierre Joye wrote: > Please restore that, now. That's not your cup of tea and it is the way > it should have been in the 1st place. > > On Wed, Jul 20, 2011 at 12:29 AM, Scott MacVicar wrote: >> scottmac Tue, 19 Jul 2011 22:29:55 + >> >> Revision: http://svn.php.net/viewvc?view=revision&revision=313455 >> >> Log: >> Revert change to use a special Windows version of >> openssl_random_pseudo_bytes(). >> >> Lets discuss this on internals first. We're advertising something from the >> OpenSSL library >> and then subverting it with another Windows OS call. >> >> What are the implications of this? Should we make this available in >> ext/standard/ instead? >> >> Changed paths: >>U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c >>U php/php-src/trunk/ext/openssl/openssl.c >> >> Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c >> === >> --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:18:08 >> UTC (rev 313454) >> +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:29:55 >> UTC (rev 313455) >> @@ -4930,19 +4930,10 @@ >> >>buffer = emalloc(buffer_length + 1); >> >> -#ifdef PHP_WIN32 >> - strong_result = 1; >> - /* random/urandom equivalent on Windows */ >> - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == >> FAILURE){ >> - efree(buffer); >> - RETURN_FALSE; >> - } >> -#else >>if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { >>efree(buffer); >>RETURN_FALSE; >>} >> -#endif >> >>buffer[buffer_length] = 0; >>RETVAL_STRINGL((char *)buffer, buffer_length, 0); >> >> Modified: php/php-src/trunk/ext/openssl/openssl.c >> === >> --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev >> 313454) >> +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev >> 313455) >> @@ -4926,19 +4926,10 @@ >> >>buffer = emalloc(buffer_length + 1); >> >> -#ifdef PHP_WIN32 >> - strong_result = 1; >> - /* random/urandom equivalent on Windows */ >> - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == >> FAILURE){ >> - efree(buffer); >> - RETURN_FALSE; >> - } >> -#else >>if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { >>efree(buffer); >>RETURN_FALSE; >>} >> -#endif >> >>buffer[buffer_length] = 0; >>RETVAL_STRINGL((char *)buffer, buffer_length, 0); >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
pajoye Tue, 19 Jul 2011 23:01:41 + Revision: http://svn.php.net/viewvc?view=revision&revision=313457 Log: - re apply the rng change specific to windows, long term it should be a std function but as this function was badly introduced in the 1st place, we have to fix the bad things here instead, pls do not revert again, bad idea. Changed paths: U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c U php/php-src/trunk/ext/openssl/openssl.c Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c === --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:38:04 UTC (rev 313456) +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 23:01:41 UTC (rev 313457) @@ -4930,10 +4930,19 @@ buffer = emalloc(buffer_length + 1); +#ifdef PHP_WIN32 + strong_result = 1; + /* random/urandom equivalent on Windows */ + if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ + efree(buffer); + RETURN_FALSE; + } +#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } +#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); Modified: php/php-src/trunk/ext/openssl/openssl.c === --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:38:04 UTC (rev 313456) +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 23:01:41 UTC (rev 313457) @@ -4926,10 +4926,19 @@ buffer = emalloc(buffer_length + 1); +#ifdef PHP_WIN32 + strong_result = 1; + /* random/urandom equivalent on Windows */ + if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ + efree(buffer); + RETURN_FALSE; + } +#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } +#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
Please restore that, now. That's not your cup of tea and it is the way it should have been in the 1st place. On Wed, Jul 20, 2011 at 12:29 AM, Scott MacVicar wrote: > scottmac Tue, 19 Jul 2011 22:29:55 + > > Revision: http://svn.php.net/viewvc?view=revision&revision=313455 > > Log: > Revert change to use a special Windows version of > openssl_random_pseudo_bytes(). > > Lets discuss this on internals first. We're advertising something from the > OpenSSL library > and then subverting it with another Windows OS call. > > What are the implications of this? Should we make this available in > ext/standard/ instead? > > Changed paths: > U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c > U php/php-src/trunk/ext/openssl/openssl.c > > Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c > === > --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:18:08 > UTC (rev 313454) > +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:29:55 > UTC (rev 313455) > @@ -4930,19 +4930,10 @@ > > buffer = emalloc(buffer_length + 1); > > -#ifdef PHP_WIN32 > - strong_result = 1; > - /* random/urandom equivalent on Windows */ > - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == > FAILURE){ > - efree(buffer); > - RETURN_FALSE; > - } > -#else > if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { > efree(buffer); > RETURN_FALSE; > } > -#endif > > buffer[buffer_length] = 0; > RETVAL_STRINGL((char *)buffer, buffer_length, 0); > > Modified: php/php-src/trunk/ext/openssl/openssl.c > === > --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev > 313454) > +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev > 313455) > @@ -4926,19 +4926,10 @@ > > buffer = emalloc(buffer_length + 1); > > -#ifdef PHP_WIN32 > - strong_result = 1; > - /* random/urandom equivalent on Windows */ > - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == > FAILURE){ > - efree(buffer); > - RETURN_FALSE; > - } > -#else > if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { > efree(buffer); > RETURN_FALSE; > } > -#endif > > buffer[buffer_length] = 0; > RETVAL_STRINGL((char *)buffer, buffer_length, 0); > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/NEWS branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c trunk/sapi/fpm/fpm/fpm_conf.c
fat Tue, 19 Jul 2011 22:38:04 + Revision: http://svn.php.net/viewvc?view=revision&revision=313456 Log: - Dropped restriction of not setting the same value multiple times, the last one holds (giovanni at giacobbi dot net) Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c U php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c Modified: php/php-src/branches/PHP_5_4/NEWS === --- php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/branches/PHP_5_4/NEWS 2011-07-19 22:38:04 UTC (rev 313456) @@ -4,6 +4,8 @@ - Improved PHP-FPM SAPI: . Added process.max to control the number of process FPM can fork. FR #55166. (fat) + . Dropped restriction of not setting the same value multiple times, the last +one holds. (giovanni at giacobbi dot net, fat) 14 Jul 2011, PHP 5.4.0 Alpha 2 - General improvements: Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_conf.c2011-07-19 22:38:04 UTC (rev 313456) @@ -195,21 +195,25 @@ static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */ { - char *new; - char **old = (char **) ((char *) *config + offset); - if (*old) { - return "it's already been defined. Can't do that twice."; + char **config_val = (char **) ((char *) *config + offset); + + if (!config_val) { + return "internal error: NULL value"; } - new = strdup(Z_STRVAL_P(value)); - if (!new) { + /* Check if there is a previous value to deallocate */ + if (*config_val) { + free(*config_val); + } + + *config_val = strdup(Z_STRVAL_P(value)); + if (!*config_val) { return "fpm_conf_set_string(): strdup() failed"; } - if (fpm_conf_expand_pool_name(&new) == -1) { + if (fpm_conf_expand_pool_name(config_val) == -1) { return "Can't use '$pool' when the pool is not defined"; } - *old = new; return NULL; } /* }}} */ @@ -219,8 +223,9 @@ char *val = Z_STRVAL_P(value); char *p; + /* we don't use strtol because we don't want to allow negative values */ for (p = val; *p; p++) { - if ( p == val && *p == '-' ) continue; + if (p == val && *p == '-') continue; if (*p < '0' || *p > '9') { return "is not a valid number (greater or equal than zero)"; } Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c === --- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:29:55 UTC (rev 313455) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c 2011-07-19 22:38:04 UTC (rev 313456) @@ -195,21 +195,25 @@ static char *fpm_conf_set_string(zval *value, void **config, intptr_t offset) /* {{{ */ { - char *new; - char **old = (char **) ((char *) *config + offset); - if (*old) { - return "it's already been defined. Can't do that twice."; + char **config_val = (char **) ((char *) *config + offset); + + if (!config_val) { + return "internal error: NULL value"; } - new = strdup(Z_STRVAL_P(value)); - if (!new) { + /* Check if there is a previous value to deallocate */ + if (*config_val) { + free(*config_val); + } + + *config_val = strdup(Z_STRVAL_P(value)); + if (!*config_val) { return "fpm_conf_set_string(): strdup() failed"; } - if (fpm_conf_expand_pool_name(&new) == -1) { + if (fpm_conf_expand_pool_name(config_val) == -1) { return "Can't use '$pool' when the pool is not defined"; } - *old = new; return NULL; } /* }}} */ @@ -219,8 +223,9 @@ char *val = Z_STRVAL_P(value); char *p; + /* we don't use strtol because we don't want to allow negative values */ for (p = val; *p; p++) { - if ( p == val && *p == '-' ) continue; + if (p == val && *p == '-') continue; if (*p < '0' || *p > '9') { return "is not a valid number (greater or equal than zero)"; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
scottmac Tue, 19 Jul 2011 22:29:55 + Revision: http://svn.php.net/viewvc?view=revision&revision=313455 Log: Revert change to use a special Windows version of openssl_random_pseudo_bytes(). Lets discuss this on internals first. We're advertising something from the OpenSSL library and then subverting it with another Windows OS call. What are the implications of this? Should we make this available in ext/standard/ instead? Changed paths: U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c U php/php-src/trunk/ext/openssl/openssl.c Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c === --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev 313454) +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev 313455) @@ -4930,19 +4930,10 @@ buffer = emalloc(buffer_length + 1); -#ifdef PHP_WIN32 - strong_result = 1; - /* random/urandom equivalent on Windows */ - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ - efree(buffer); - RETURN_FALSE; - } -#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } -#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); Modified: php/php-src/trunk/ext/openssl/openssl.c === --- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:18:08 UTC (rev 313454) +++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:29:55 UTC (rev 313455) @@ -4926,19 +4926,10 @@ buffer = emalloc(buffer_length + 1); -#ifdef PHP_WIN32 - strong_result = 1; - /* random/urandom equivalent on Windows */ - if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){ - efree(buffer); - RETURN_FALSE; - } -#else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); RETURN_FALSE; } -#endif buffer[buffer_length] = 0; RETVAL_STRINGL((char *)buffer, buffer_length, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/openssl/openssl.c branches/PHP_5_4/ext/openssl/openssl.c trunk/ext/openssl/openssl.c
scottmac Tue, 19 Jul 2011 22:15:56 + Revision: http://svn.php.net/viewvc?view=revision&revision=313453 Log: openssl_encrypt() / openssl_decrypt() were flawed and truncated the key to the default size for the case of a variable key length cipher. The result is a key of 448 bits being passed to the blowfish algorithm would be truncated to 128 bit. Also fixed an error in the zend_parse_parameters() having an invalid character being used. Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/openssl/openssl.c U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c U php/php-src/trunk/ext/openssl/openssl.c Modified: php/php-src/branches/PHP_5_3/NEWS === --- php/php-src/branches/PHP_5_3/NEWS 2011-07-19 22:12:13 UTC (rev 313452) +++ php/php-src/branches/PHP_5_3/NEWS 2011-07-19 22:15:56 UTC (rev 313453) @@ -4,6 +4,10 @@ - Improved core functions: . Updated crypt_blowfish to 1.2. ((CVE-2011-2483) (Solar Designer) +- OpenSSL + . openssl_encrypt()/openssl_decrypt() truncated keys of variable length +ciphers to the OpenSSL default for the algorithm. (Scott) + 14 Jul 2011, PHP 5.3.7 RC3 - Zend Engine: . Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even Modified: php/php-src/branches/PHP_5_3/ext/openssl/openssl.c === --- php/php-src/branches/PHP_5_3/ext/openssl/openssl.c 2011-07-19 22:12:13 UTC (rev 313452) +++ php/php-src/branches/PHP_5_3/ext/openssl/openssl.c 2011-07-19 22:15:56 UTC (rev 313453) @@ -4708,7 +4708,11 @@ outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); - EVP_EncryptInit(&cipher_ctx, cipher_type, key, (unsigned char *)iv); + EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); + if (password_len > keylen) { + EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); + } + EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); EVP_EncryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); outlen = i; if (EVP_EncryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { @@ -4788,7 +4792,11 @@ outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); - EVP_DecryptInit(&cipher_ctx, cipher_type, key, (unsigned char *)iv); + EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); + if (password_len > keylen) { + EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); + } + EVP_DecryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); EVP_DecryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); outlen = i; if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c === --- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:12:13 UTC (rev 313452) +++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:15:56 UTC (rev 313453) @@ -1020,9 +1020,7 @@ OpenSSL_add_all_digests(); OpenSSL_add_all_algorithms(); - ERR_load_ERR_strings(); - ERR_load_crypto_strings(); - ERR_load_EVP_strings(); + SSL_load_error_strings(); /* register a resource id number with OpenSSL so that we can map SSL -> stream structures in * OpenSSL callbacks */ @@ -3043,7 +3041,7 @@ BIO * bio_out = NULL; const EVP_CIPHER * cipher; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zṕ|s!a!", &zpkey, &filename, &filename_len, &passphrase, &passphrase_len, &args) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zp|s!a!", &zpkey, &filename, &filename_len, &passphrase, &passphrase_len, &args) == FAILURE) { return; } RETVAL_FALSE; @@ -4726,7 +4724,11 @@ outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); - EVP_EncryptInit(&cipher_ctx, cipher_type, key, (unsigned char *)iv); + EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL); + if (password_len > keylen) { + EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); + } + EVP_EncryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } @@ -4809,7 +4811,11 @@ outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); - EVP_DecryptInit(&cipher_ctx, cipher_type, key, (unsigned char *)iv); + EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); + if (password_len > key
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/php_crypt_r.c branches/PHP_5_4/ext/standard/php_crypt_r.c trunk/ext/standard/php_crypt_r.c
felipe Tue, 19 Jul 2011 22:12:13 + Revision: http://svn.php.net/viewvc?view=revision&revision=313452 Log: - Fixed bug #55231 (Unsatisfied symbols __sync_fetch_and_add_4) Bug: https://bugs.php.net/55231 (Feedback) Unsatisfied symbols __sync_fetch_and_add_4 Changed paths: U php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c U php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c U php/php-src/trunk/ext/standard/php_crypt_r.c Modified: php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c === --- php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c 2011-07-19 21:40:09 UTC (rev 313451) +++ php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c 2011-07-19 22:12:13 UTC (rev 313452) @@ -94,7 +94,8 @@ if (!initialized) { #ifdef PHP_WIN32 InterlockedIncrement(&initialized); -#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1)) +#elif (defined(__GNUC__) && (__GNUC__ > 4 || \ +(__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1) __sync_fetch_and_add(&initialized, 1); #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ membar_producer(); Modified: php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c === --- php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c 2011-07-19 21:40:09 UTC (rev 313451) +++ php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c 2011-07-19 22:12:13 UTC (rev 313452) @@ -94,7 +94,8 @@ if (!initialized) { #ifdef PHP_WIN32 InterlockedIncrement(&initialized); -#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1)) +#elif (defined(__GNUC__) && (__GNUC__ > 4 || \ +(__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1) __sync_fetch_and_add(&initialized, 1); #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ membar_producer(); Modified: php/php-src/trunk/ext/standard/php_crypt_r.c === --- php/php-src/trunk/ext/standard/php_crypt_r.c2011-07-19 21:40:09 UTC (rev 313451) +++ php/php-src/trunk/ext/standard/php_crypt_r.c2011-07-19 22:12:13 UTC (rev 313452) @@ -94,7 +94,8 @@ if (!initialized) { #ifdef PHP_WIN32 InterlockedIncrement(&initialized); -#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 1)) +#elif (defined(__GNUC__) && (__GNUC__ > 4 || \ +(__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1) __sync_fetch_and_add(&initialized, 1); #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */ membar_producer(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/interbase/ ibase_query.c
mariuz Tue, 19 Jul 2011 20:25:51 + Revision: http://svn.php.net/viewvc?view=revision&revision=313447 Log: Fix for bug http://bugs.php.net/54426 Checks for NULL are wrong as the values can be provided by the triggers Changed paths: U php/php-src/branches/PHP_5_3/ext/interbase/ibase_query.c Modified: php/php-src/branches/PHP_5_3/ext/interbase/ibase_query.c === --- php/php-src/branches/PHP_5_3/ext/interbase/ibase_query.c2011-07-19 20:23:26 UTC (rev 313446) +++ php/php-src/branches/PHP_5_3/ext/interbase/ibase_query.c2011-07-19 20:25:51 UTC (rev 313447) @@ -672,14 +672,7 @@ if (! force_null) break; case IS_NULL: - - /* complain if this field doesn't allow NULL values */ - if (! (var->sqltype & 1)) { - _php_ibase_module_error("Parameter %d: non-empty value required" TSRMLS_CC, i+1); - rv = FAILURE; - } else { buf[i].sqlind = -1; - } if (var->sqltype & SQL_ARRAY) ++array_cnt; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/interbase/ ibase_query.c
mariuz Tue, 19 Jul 2011 20:23:26 + Revision: http://svn.php.net/viewvc?view=revision&revision=313446 Log: Fix for bug http://bugs.php.net/54426 Checks for NULL are wrong as the values can be provided by the triggers Changed paths: U php/php-src/branches/PHP_5_4/ext/interbase/ibase_query.c Modified: php/php-src/branches/PHP_5_4/ext/interbase/ibase_query.c === --- php/php-src/branches/PHP_5_4/ext/interbase/ibase_query.c2011-07-19 20:08:42 UTC (rev 313445) +++ php/php-src/branches/PHP_5_4/ext/interbase/ibase_query.c2011-07-19 20:23:26 UTC (rev 313446) @@ -672,14 +672,7 @@ if (! force_null) break; case IS_NULL: - - /* complain if this field doesn't allow NULL values */ - if (! (var->sqltype & 1)) { - _php_ibase_module_error("Parameter %d: non-empty value required" TSRMLS_CC, i+1); - rv = FAILURE; - } else { buf[i].sqlind = -1; - } if (var->sqltype & SQL_ARRAY) ++array_cnt; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ext/interbase/ ibase_query.c
mariuz Tue, 19 Jul 2011 20:08:42 + Revision: http://svn.php.net/viewvc?view=revision&revision=313445 Log: Fix for bug http://bugs.php.net/54426 Checks for NULL are wrong as the values can be provided by the triggers Changed paths: U php/php-src/trunk/ext/interbase/ibase_query.c Modified: php/php-src/trunk/ext/interbase/ibase_query.c === --- php/php-src/trunk/ext/interbase/ibase_query.c 2011-07-19 18:17:25 UTC (rev 313444) +++ php/php-src/trunk/ext/interbase/ibase_query.c 2011-07-19 20:08:42 UTC (rev 313445) @@ -672,14 +672,7 @@ if (! force_null) break; case IS_NULL: - - /* complain if this field doesn't allow NULL values */ - if (! (var->sqltype & 1)) { - _php_ibase_module_error("Parameter %d: non-empty value required" TSRMLS_CC, i+1); - rv = FAILURE; - } else { buf[i].sqlind = -1; - } if (var->sqltype & SQL_ARRAY) ++array_cnt; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c
moriyoshiTue, 19 Jul 2011 18:17:25 + Revision: http://svn.php.net/viewvc?view=revision&revision=313444 Log: - Fixed bug #55107 (Null bytes in URL cause insecure behavior (code execution / code disclosure)). Bug: https://bugs.php.net/55107 (Verified) Null bytes in URL cause insecure behavior (code execution / code disclosure) Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c U php/php-src/trunk/sapi/cli/php_cli_server.c Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c === --- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 18:08:09 UTC (rev 313443) +++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 18:17:25 UTC (rev 313444) @@ -242,6 +242,7 @@ }; static php_cli_server_http_reponse_status_code_pair template_map[] = { + { 400, "%sYour browser sent a request that this server could not understand." }, { 404, "%sThe requested resource %s was not found on this server." }, { 500, "%sThe server is temporality unavaiable." } }; @@ -1600,6 +1601,11 @@ destroy_request_info(&SG(request_info)); return FAILURE; } + if (strlen(client->request.path_translated) != client->request.path_translated_len) { + /* can't handle paths that contain nul bytes */ + destroy_request_info(&SG(request_info)); + return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); + } { zend_file_handle zfd; zfd.type = ZEND_HANDLE_FILENAME; @@ -1625,6 +1631,11 @@ int fd; int status = 200; + if (client->request.path_translated && strlen(client->request.path_translated) != client->request.path_translated_len) { + /* can't handle paths that contain nul bytes */ + return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); + } + fd = client->request.path_translated ? open(client->request.path_translated, O_RDONLY): -1; if (fd < 0) { char *errstr = get_last_error(); Modified: php/php-src/trunk/sapi/cli/php_cli_server.c === --- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 18:08:09 UTC (rev 313443) +++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 18:17:25 UTC (rev 313444) @@ -242,6 +242,7 @@ }; static php_cli_server_http_reponse_status_code_pair template_map[] = { + { 400, "%sYour browser sent a request that this server could not understand." }, { 404, "%sThe requested resource %s was not found on this server." }, { 500, "%sThe server is temporality unavaiable." } }; @@ -1600,6 +1601,11 @@ destroy_request_info(&SG(request_info)); return FAILURE; } + if (strlen(client->request.path_translated) != client->request.path_translated_len) { + /* can't handle paths that contain nul bytes */ + destroy_request_info(&SG(request_info)); + return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); + } { zend_file_handle zfd; zfd.type = ZEND_HANDLE_FILENAME; @@ -1625,6 +1631,11 @@ int fd; int status = 200; + if (client->request.path_translated && strlen(client->request.path_translated) != client->request.path_translated_len) { + /* can't handle paths that contain nul bytes */ + return php_cli_server_send_error_page(server, client, 400 TSRMLS_CC); + } + fd = client->request.path_translated ? open(client->request.path_translated, O_RDONLY): -1; if (fd < 0) { char *errstr = get_last_error(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /SVNROOT/ global_avail
dsp Tue, 19 Jul 2011 18:08:09 + Revision: http://svn.php.net/viewvc?view=revision&revision=313443 Log: give fa php-src karma to commit cli-webserver patches Changed paths: U SVNROOT/global_avail Modified: SVNROOT/global_avail === --- SVNROOT/global_avail2011-07-19 18:00:16 UTC (rev 313442) +++ SVNROOT/global_avail2011-07-19 18:08:09 UTC (rev 313443) @@ -16,7 +16,7 @@ # The PHP Developers have full access to the full source trees for # PHP, as well as the documentation. -avail|patrickallaert,mgdm,pierrick,ilewis,mkoppanen,lstrojny,dharmap,kraghuba,stevseea,colder,lwe,auroraeosrose,mike,rolland,cawa,msisolak,alan_k,rrichards,tal,mfischer,fmk,hirokawa,jah,eschmid,dbeu,sebastian,samjam,avsm,ronabob,derick,sterling,venaas,stas,hholzgra,cmv,phildriscoll,jmoore,andre,jani,sr,david,jdonagher,chagenbu,jon,elixer,joosters,jason,mysql,kalowsky,opaquedave,steinm,phanto,gluke,svanegmond,rjs,vlad,jimjag,emile,wez,sasha,camber,ohrn,romolo,martin,lurcher,wsanchez,dreid,bmcadams,swm,zhang,kevin,joey,entity,cardinal,coar,jflemer,raphael,danda,rbb,mboeren,dougm,edink,alexwaugh,bernd,zak,sesser,yohgaki,imajes,markonen,dickmeiss,helly,sander,jan,kir,aaron,jwoolley,pbannister,rvenkat,dali,rodif_bl,hyanantha,witten,georg,msopacua,mpdoremus,fujimoto,iliaa,chregu,azzit,gschlossnagle,andrey,dan,moriyoshi,dviner,bfrance,flex,iwakiri,john,harrie,pollita,ianh,k.schroeder,dcowgill,jerenkrantz,jay,ddhill,jorton,thetaphi,abies,vincent,goba,dmitry,pajoye,shie,rafi,magnus,! tony2001,johannes,dbs,skoduru,nrathna,jesus,gopalv,bjori,nlopess,wrowe,shire,zoe,scottmac,t2man,dsp,davidw,ab5602,nicholsr,lsmith,cellog,davidc,felipe,robinf,jmessa,philip,sixd,gwynne,ant,kalle,mattwil,sfox,hnangelo,ohill,indeyets,felixdv,mich4ld,lbarnaud,cseiler,sean,dkelsey,tabe,ericstewart,mbeccati,sebs,garretts,guenter,srinatar,basantk,geissert,salathe,aharvey,mj,gron,uw,fat,cataphract,sbeattie,acurioso,lytboris,shm|php/php-src,pecl,phpdoc,phd,web/doc,web/doc-editor +avail|patrickallaert,mgdm,pierrick,ilewis,mkoppanen,lstrojny,dharmap,kraghuba,stevseea,colder,lwe,auroraeosrose,mike,rolland,cawa,msisolak,alan_k,rrichards,tal,mfischer,fmk,hirokawa,jah,eschmid,dbeu,sebastian,samjam,avsm,ronabob,derick,sterling,venaas,stas,hholzgra,cmv,phildriscoll,jmoore,andre,jani,sr,david,jdonagher,chagenbu,jon,elixer,joosters,jason,mysql,kalowsky,opaquedave,steinm,phanto,gluke,svanegmond,rjs,vlad,jimjag,emile,wez,sasha,camber,ohrn,romolo,martin,lurcher,wsanchez,dreid,bmcadams,swm,zhang,kevin,joey,entity,cardinal,coar,jflemer,raphael,danda,rbb,mboeren,dougm,edink,alexwaugh,bernd,zak,sesser,yohgaki,imajes,markonen,dickmeiss,helly,sander,jan,kir,aaron,jwoolley,pbannister,rvenkat,dali,rodif_bl,hyanantha,witten,georg,msopacua,mpdoremus,fujimoto,iliaa,chregu,azzit,gschlossnagle,andrey,dan,moriyoshi,dviner,bfrance,flex,iwakiri,john,harrie,pollita,ianh,k.schroeder,dcowgill,jerenkrantz,jay,ddhill,jorton,thetaphi,abies,vincent,goba,dmitry,pajoye,shie,rafi,magnus,! tony2001,johannes,dbs,skoduru,nrathna,jesus,gopalv,bjori,nlopess,wrowe,shire,zoe,scottmac,t2man,dsp,davidw,ab5602,nicholsr,lsmith,cellog,davidc,felipe,robinf,jmessa,philip,sixd,gwynne,ant,kalle,mattwil,sfox,hnangelo,ohill,indeyets,felixdv,mich4ld,lbarnaud,cseiler,sean,dkelsey,tabe,ericstewart,mbeccati,sebs,garretts,guenter,srinatar,basantk,geissert,salathe,aharvey,mj,gron,uw,fat,cataphract,sbeattie,acurioso,lytboris,shm,fa|php/php-src,pecl,phpdoc,phd,web/doc,web/doc-editor # Engine karma is further restricted (this line MUST come after lines granting # php-src karma and before lines granting Zend/TSRM karma) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c
moriyoshiTue, 19 Jul 2011 18:00:16 + Revision: http://svn.php.net/viewvc?view=revision&revision=313442 Log: - Buffers are local to the blocks where they belong. Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c U php/php-src/trunk/sapi/cli/php_cli_server.c Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c === --- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 17:47:34 UTC (rev 313441) +++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 18:00:16 UTC (rev 313442) @@ -2048,6 +2048,7 @@ extern const opt_struct OPTIONS[]; const char *document_root = NULL; const char *router = NULL; + char document_root_buf[MAXPATHLEN]; while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2))!=-1) { switch (c) { @@ -2062,7 +2063,6 @@ if (document_root) { struct stat sb; - char resolved_path[MAXPATHLEN]; if (stat(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); @@ -2072,19 +2072,18 @@ fprintf(stderr, "%s is not a directory.\n", document_root); return 1; } - if (VCWD_REALPATH(document_root, resolved_path)) { - document_root = resolved_path; + if (VCWD_REALPATH(document_root, document_root_buf)) { + document_root = document_root_buf; } } else { - char path[MAXPATHLEN]; char *ret = NULL; #if HAVE_GETCWD - ret = VCWD_GETCWD(path, MAXPATHLEN); + ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN); #elif HAVE_GETWD - ret = VCWD_GETWD(path); + ret = VCWD_GETWD(document_root_buf); #endif - document_root = ret ? path : "."; + document_root = ret ? document_root_buf: "."; } if (argc > php_optind) { Modified: php/php-src/trunk/sapi/cli/php_cli_server.c === --- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 17:47:34 UTC (rev 313441) +++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 18:00:16 UTC (rev 313442) @@ -2048,6 +2048,7 @@ extern const opt_struct OPTIONS[]; const char *document_root = NULL; const char *router = NULL; + char document_root_buf[MAXPATHLEN]; while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2))!=-1) { switch (c) { @@ -2062,7 +2063,6 @@ if (document_root) { struct stat sb; - char resolved_path[MAXPATHLEN]; if (stat(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); @@ -2072,19 +2072,18 @@ fprintf(stderr, "%s is not a directory.\n", document_root); return 1; } - if (VCWD_REALPATH(document_root, resolved_path)) { - document_root = resolved_path; + if (VCWD_REALPATH(document_root, document_root_buf)) { + document_root = document_root_buf; } } else { - char path[MAXPATHLEN]; char *ret = NULL; #if HAVE_GETCWD - ret = VCWD_GETCWD(path, MAXPATHLEN); + ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN); #elif HAVE_GETWD - ret = VCWD_GETWD(path); + ret = VCWD_GETWD(document_root_buf); #endif - document_root = ret ? path : "."; + document_root = ret ? document_root_buf: "."; } if (argc > php_optind) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c
moriyoshiTue, 19 Jul 2011 17:47:34 + Revision: http://svn.php.net/viewvc?view=revision&revision=313441 Log: - Print HTTP method as well in the log. - Print response code also when the request is processed by a script. - Those changes partly closes #55109. Bug: https://bugs.php.net/55109 (Assigned) Friendly log messages Changed paths: U php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c U php/php-src/trunk/sapi/cli/php_cli_server.c Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c === --- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 16:17:07 UTC (rev 313440) +++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19 17:47:34 UTC (rev 313441) @@ -1479,7 +1479,7 @@ static void php_cli_server_close_connection(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) /* {{{ */ { #ifdef DEBUG - php_cli_server_logf("%s: Closing" TSRMLS_CC, client->addr_str); + php_cli_server_logf("%s Closing" TSRMLS_CC, client->addr_str); #endif zend_hash_index_del(&server->clients, client->sock); } /* }}} */ @@ -1575,7 +1575,7 @@ php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk); } - php_cli_server_logf("%s: %s - Sending error page (%d)" TSRMLS_CC, client->addr_str, client->request.request_uri, status); + php_cli_server_logf("%s %s %s - Sending error page (%d)" TSRMLS_CC, client->addr_str, php_http_method_str(client->request.request_method), client->request.request_uri, status); php_cli_server_poller_add(&server->poller, POLLOUT, client->sock); efree(escaped_request_uri); return SUCCESS; @@ -1612,6 +1612,8 @@ } zend_end_try(); } + php_cli_server_logf("%s %s %s - Response sent successfully (%d)" TSRMLS_CC, client->addr_str, php_http_method_str(client->request.request_method), client->request.request_uri, SG(sapi_headers).http_response_code); + php_request_shutdown(0); php_cli_server_close_connection(server, client TSRMLS_CC); destroy_request_info(&SG(request_info)); @@ -1627,10 +1629,10 @@ if (fd < 0) { char *errstr = get_last_error(); if (errstr) { - php_cli_server_logf("%s: %s - %s" TSRMLS_CC, client->addr_str, client->request.request_uri, errstr); + php_cli_server_logf("%s %s %s - %s" TSRMLS_CC, client->addr_str, php_http_method_str(client->request.request_method), client->request.request_uri, errstr); pefree(errstr, 1); } else { - php_cli_server_logf("%s: %s - ?" TSRMLS_CC, client->addr_str, client->request.request_uri); + php_cli_server_logf("%s %s %s - ?" TSRMLS_CC, client->addr_str, php_http_method_str(client->request.request_method), client->request.request_uri); } return php_cli_server_send_error_page(server, client, 404 TSRMLS_CC); } @@ -1880,12 +1882,12 @@ char *errstr = NULL; int status = php_cli_server_client_read_request(client, &errstr TSRMLS_CC); if (status < 0) { - php_cli_server_logf("%s: Invalid request (%s)" TSRMLS_CC, client->addr_str, errstr); + php_cli_server_logf("%s Invalid request (%s)" TSRMLS_CC, client->addr_str, errstr); efree(errstr); php_cli_server_close_connection(server, client TSRMLS_CC); return FAILURE; } else if (status == 1) { - php_cli_server_logf("%s: %s" TSRMLS_CC, client->addr_str, client->request.request_uri); + php_cli_server_logf("%s %s %s - Request read" TSRMLS_CC, client->addr_str, php_http_method_str(client->request.request_method), client->request.request_uri); php_cli_server_poller_remove(&server->poller, POLLIN, client->sock); php_cli_server_dispatch(server, client TSRMLS_CC); } else { @@ -1970,7 +1972,7 @@ return SUCCESS; } #ifdef DEBUG - php_cli_server_logf("%s: Accepted" TSRMLS_CC, client->addr_str); + php_cli_server_logf("%s Accepted" TSRMLS_CC, client->addr_str); #endif zend_hash_index_update(&server->clients, client_sock, &client, sizeof(client), NULL); php_cli_server_recv_event_read_request(server, client TSRMLS_CC); Modified: php/php-src/trunk/sapi/cli/php_cli_server.c === --- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 16:17:07 UTC (rev 313440) +++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 17:47:34 UTC (rev 313441) @@ -1479,7 +1479,7 @@ static void php_cli_server_close_connection(php_cli_server *server, php_cli_server_client *client T
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/php.ini-development branches/PHP_5_4/php.ini-production trunk/php.ini-development trunk/php.ini-production
pajoye Tue, 19 Jul 2011 12:02:22 + Revision: http://svn.php.net/viewvc?view=revision&revision=313421 Log: - cleanup Changed paths: U php/php-src/branches/PHP_5_4/php.ini-development U php/php-src/branches/PHP_5_4/php.ini-production U php/php-src/trunk/php.ini-development U php/php-src/trunk/php.ini-production Modified: php/php-src/branches/PHP_5_4/php.ini-development === --- php/php-src/branches/PHP_5_4/php.ini-development2011-07-19 11:38:23 UTC (rev 313420) +++ php/php-src/branches/PHP_5_4/php.ini-development2011-07-19 12:02:22 UTC (rev 313421) @@ -883,7 +883,6 @@ ; ;extension=php_bz2.dll ;extension=php_curl.dll -;extension=php_dba.dll ;extension=php_fileinfo.dll ;extension=php_gd2.dll ;extension=php_gettext.dll @@ -894,8 +893,6 @@ ;extension=php_ldap.dll ;extension=php_mbstring.dll ;extension=php_exif.dll ; Must be after mbstring as it depends on it -;extension=php_ming.dll -;extension=php_mssql.dll ;extension=php_mysql.dll ;extension=php_mysqli.dll ;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client Modified: php/php-src/branches/PHP_5_4/php.ini-production === --- php/php-src/branches/PHP_5_4/php.ini-production 2011-07-19 11:38:23 UTC (rev 313420) +++ php/php-src/branches/PHP_5_4/php.ini-production 2011-07-19 12:02:22 UTC (rev 313421) @@ -899,7 +899,6 @@ ;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client ;extension=php_openssl.dll ;extension=php_pdo_firebird.dll -;extension=php_pdo_mssql.dll ;extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_odbc.dll Modified: php/php-src/trunk/php.ini-development === --- php/php-src/trunk/php.ini-development 2011-07-19 11:38:23 UTC (rev 313420) +++ php/php-src/trunk/php.ini-development 2011-07-19 12:02:22 UTC (rev 313421) @@ -883,7 +883,6 @@ ; ;extension=php_bz2.dll ;extension=php_curl.dll -;extension=php_dba.dll ;extension=php_fileinfo.dll ;extension=php_gd2.dll ;extension=php_gettext.dll @@ -894,8 +893,6 @@ ;extension=php_ldap.dll ;extension=php_mbstring.dll ;extension=php_exif.dll ; Must be after mbstring as it depends on it -;extension=php_ming.dll -;extension=php_mssql.dll ;extension=php_mysql.dll ;extension=php_mysqli.dll ;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client Modified: php/php-src/trunk/php.ini-production === --- php/php-src/trunk/php.ini-production2011-07-19 11:38:23 UTC (rev 313420) +++ php/php-src/trunk/php.ini-production2011-07-19 12:02:22 UTC (rev 313421) @@ -899,7 +899,6 @@ ;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client ;extension=php_openssl.dll ;extension=php_pdo_firebird.dll -;extension=php_pdo_mssql.dll ;extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_odbc.dll -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/win32/build/libs_version.txt branches/PHP_5_4/win32/build/libs_version.txt trunk/win32/build/libs_version.txt
pajoye Tue, 19 Jul 2011 10:22:42 + Revision: http://svn.php.net/viewvc?view=revision&revision=313417 Log: - update libpng to 1.2.46 Changed paths: U php/php-src/branches/PHP_5_3/win32/build/libs_version.txt U php/php-src/branches/PHP_5_4/win32/build/libs_version.txt U php/php-src/trunk/win32/build/libs_version.txt Modified: php/php-src/branches/PHP_5_3/win32/build/libs_version.txt === --- php/php-src/branches/PHP_5_3/win32/build/libs_version.txt 2011-07-19 09:53:20 UTC (rev 313416) +++ php/php-src/branches/PHP_5_3/win32/build/libs_version.txt 2011-07-19 10:22:42 UTC (rev 313417) @@ -1 +1,2 @@ libcurl-7.21.6 +libpng-1.2.46 Modified: php/php-src/branches/PHP_5_4/win32/build/libs_version.txt === --- php/php-src/branches/PHP_5_4/win32/build/libs_version.txt 2011-07-19 09:53:20 UTC (rev 313416) +++ php/php-src/branches/PHP_5_4/win32/build/libs_version.txt 2011-07-19 10:22:42 UTC (rev 313417) @@ -1,2 +1,2 @@ libcurl-7.21.6 -libpng-1.2.45 \ No newline at end of file +libpng-1.2.46 Modified: php/php-src/trunk/win32/build/libs_version.txt === --- php/php-src/trunk/win32/build/libs_version.txt 2011-07-19 09:53:20 UTC (rev 313416) +++ php/php-src/trunk/win32/build/libs_version.txt 2011-07-19 10:22:42 UTC (rev 313417) @@ -1,2 +1,2 @@ libcurl-7.21.6 -libpng-1.2.45 +libpng-1.2.46 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php