8fe74e69e8
the FastCGI protocol. ok alek@
42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
--- fcgi_pm.c.orig Thu Oct 30 02:08:34 2003
|
|
+++ fcgi_pm.c Mon Feb 14 06:57:49 2005
|
|
@@ -26,7 +26,7 @@ time_t fcgi_dynamic_epoch = 0;
|
|
* invoked by process mgr */
|
|
time_t fcgi_dynamic_last_analyzed = 0; /* last time calculation was
|
|
* made for the dynamic procs */
|
|
-
|
|
+int fcgi_is_chrooted = 0; /* If we run in a chrooted httpd */
|
|
static time_t now = 0;
|
|
|
|
#ifdef WIN32
|
|
@@ -1092,6 +1092,8 @@ static void dynamic_read_msgs(int read_r
|
|
/* Create socket file's path */
|
|
s->socket_path = fcgi_util_socket_hash_filename(tp, execName, user, group);
|
|
s->socket_path = fcgi_util_socket_make_path_absolute(sp, s->socket_path, 1);
|
|
+ if (fcgi_is_chrooted)
|
|
+ ap_server_strip_chroot((char *) s->socket_path, 1);
|
|
|
|
/* Create sockaddr, prealloc it so it won't get created in tp */
|
|
s->socket_addr = ap_pcalloc(sp, sizeof(struct sockaddr_un));
|
|
@@ -1649,7 +1651,19 @@ void fcgi_pm_main(void *dummy)
|
|
fcgi_config_set_env_var(fcgi_config_pool, dynamicEnvp, &i, "SystemRoot");
|
|
|
|
#else
|
|
-
|
|
+
|
|
+ if (ap_server_chroot_desired()) {
|
|
+ if (chroot(ap_server_root) < 0) {
|
|
+ ap_log_error(FCGI_LOG_NOTICE_NOERRNO, fcgi_apache_main_server,
|
|
+ "FastCGI: process manager unable to chroot into %s!", ap_server_root);
|
|
+ exit(1);
|
|
+ }
|
|
+ ap_log_error(FCGI_LOG_NOTICE_NOERRNO,
|
|
+ fcgi_apache_main_server, "FastCGI: process manager chrooted in %s", ap_server_root);
|
|
+ chdir("/");
|
|
+ fcgi_is_chrooted = 1;
|
|
+ }
|
|
+
|
|
reduce_privileges();
|
|
change_process_name("fcgi-pm");
|
|
|