dmitry Tue Dec 5 08:55:15 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/sapi/cgi fastcgi.c
Log:
Fixed FastCGI impersonation for persistent connections on Windows
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.401&r2=1.2027.2.547.2.402&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.401 php-src/NEWS:1.2027.2.547.2.402
--- php-src/NEWS:1.2027.2.547.2.401 Tue Dec 5 01:39:07 2006
+++ php-src/NEWS Tue Dec 5 08:55:15 2006
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2007, PHP 5.2.1
+- Fixed FastCGI impersonation for persistent connections on Windows. (Dmitry)
- Added a meta tag to phpinfo() output to prevent search engines from indexing
the page. (Ilia)
- Added missing object support to file_put_contents(). (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.11&r2=1.4.2.13.2.12&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.11
php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.12
--- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.11 Mon Oct 16 10:46:59 2006
+++ php-src/sapi/cgi/fastcgi.c Tue Dec 5 08:55:15 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fastcgi.c,v 1.4.2.13.2.11 2006/10/16 10:46:59 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.4.2.13.2.12 2006/12/05 08:55:15 dmitry Exp $ */
#include "php.h"
#include "fastcgi.h"
@@ -616,6 +616,13 @@
if (destroy) {
zend_hash_destroy(&req->env);
}
+
+#ifdef _WIN32
+ if (is_impersonate) {
+ RevertToSelf();
+ }
+#endif
+
if ((force || !req->keep) && req->fd >= 0) {
#ifdef _WIN32
HANDLE pipe = (HANDLE)_get_osfhandle(req->fd);
@@ -624,9 +631,6 @@
FlushFileBuffers(pipe);
}
DisconnectNamedPipe(pipe);
- if (is_impersonate) {
- RevertToSelf();
- }
#else
if (!force) {
char buf[8];
@@ -673,12 +677,7 @@
}
}
CloseHandle(ov.hEvent);
- if (is_impersonate &&
!ImpersonateNamedPipeClient(pipe)) {
- DisconnectNamedPipe(pipe);
- req->fd = -1;
- } else {
- req->fd = req->listen_socket;
- }
+ req->fd = req->listen_socket;
FCGI_UNLOCK(req->listen_socket);
#else
{
@@ -718,6 +717,15 @@
return -1;
}
if (fcgi_read_request(req)) {
+#ifdef _WIN32
+ if (is_impersonate) {
+ pipe = (HANDLE)_get_osfhandle(req->fd);
+ if (!ImpersonateNamedPipeClient(pipe)) {
+ fcgi_close(req, 1, 1);
+ continue;
+ }
+ }
+#endif
return req->fd;
} else {
fcgi_close(req, 1, 1);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php