cvs: php4 /sapi/fastcgi fastcgi.c
| From: | Shane Caraveo | Date: | Mon, 18 Mar 2002 04:46:33 +0000 |
| Subject: | cvs: php4 /sapi/fastcgi fastcgi.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10320@lists.php.net to get a copy of this message | ||
shane Sun Mar 17 23:46:33 2002 EDT
Modified files:
/php4/sapi/fastcgi fastcgi.c
Log:
Add impersonation feature for running under IIS
Index: php4/sapi/fastcgi/fastcgi.c
diff -u php4/sapi/fastcgi/fastcgi.c:1.24 php4/sapi/fastcgi/fastcgi.c:1.25
--- php4/sapi/fastcgi/fastcgi.c:1.24 Mon Mar 11 08:37:25 2002
+++ php4/sapi/fastcgi/fastcgi.c Sun Mar 17 23:46:32 2002
@@ -53,6 +53,8 @@
#include <io.h>
#include <fcntl.h>
#include "win32/php_registry.h"
+/* don't want to include fcgios.h, causes conflicts */
+extern int OS_SetImpersonate(void);
#else
#include <sys/wait.h>
#endif
@@ -357,6 +359,8 @@
zend_file_handle file_handle;
char *s;
int status;
+#else
+ int impersonate = 0;
#endif
char *argv0=NULL;
char *script_file=NULL;
@@ -461,6 +465,10 @@
}
}
+ /* Initialise FastCGI request structure */
+ FCGX_Init();
+ FCGX_InitRequest( &request, fcgi_fd, 0 );
+
#ifndef PHP_WIN32
/* Pre-fork, if required */
if( getenv( "PHP_FCGI_CHILDREN" )) {
@@ -472,10 +480,6 @@
}
}
- /* Initialise FastCGI request structure */
- FCGX_Init();
- FCGX_InitRequest( &request, fcgi_fd, 0 );
-
if( children ) {
int running = 0;
int i;
@@ -545,6 +549,14 @@
/* Main FastCGI loop */
#ifdef DEBUG_FASTCGI
fprintf( stderr, "Going into accept loop\n" );
+#endif
+#ifdef PHP_WIN32
+ /* attempt to set security impersonation for fastcgi
+ will only happen on NT based OS, others will ignore it. */
+ if (cfg_get_long("fastcgi.impersonate", &impersonate) == FAILURE) {
+ impersonate = 0;
+ }
+ if (impersonate) OS_SetImpersonate();
#endif
while( FCGX_Accept_r( &request ) >= 0 ) {