summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2001-09-12 02:07:46 +0000
committerfoobar <sniper@php.net>2001-09-12 02:07:46 +0000
commit5275b603987d197daa8318b55d6a9118c83a7fde (patch)
treed20f698b5fd4008d3e5a3738d00235f93b5c1f8a /ext/standard
parent8d88df34372472c67098ce9cff3ec37965e4712f (diff)
downloadphp-git-5275b603987d197daa8318b55d6a9118c83a7fde.tar.gz
Enable chroot() only if SAPI is CGI.
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/config.m44
-rw-r--r--ext/standard/dir.c2
-rw-r--r--ext/standard/php_dir.h2
4 files changed, 7 insertions, 3 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 7d10d5c044..f401bd192a 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -653,7 +653,7 @@ function_entry basic_functions[] = {
PHP_FE(closedir, NULL)
PHP_FE(chdir, NULL)
-#if defined(HAVE_CHROOT) && !defined(ZTS)
+#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
PHP_FE(chroot, NULL)
#else
PHP_FALIAS(chroot, warn_not_available, NULL)
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index cdfa5269dc..e0043d23a7 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -229,4 +229,8 @@ AC_ARG_WITH(system-regex,
fi
])
+if test "$PHP_SAPI" = "cgi"; then
+ AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function])
+fi
+
PHP_EXTENSION(standard)
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index b0022e28e5..186318a6bf 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -221,7 +221,7 @@ PHP_FUNCTION(closedir)
/* }}} */
-#if defined(HAVE_CHROOT) && !defined(ZTS)
+#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
/* {{{ proto int chroot(string directory)
Change root directory */
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
index 186a7cdc89..3b648c62df 100644
--- a/ext/standard/php_dir.h
+++ b/ext/standard/php_dir.h
@@ -28,7 +28,7 @@ PHP_RINIT_FUNCTION(dir);
PHP_FUNCTION(opendir);
PHP_FUNCTION(closedir);
PHP_FUNCTION(chdir);
-#if defined(HAVE_CHROOT) && !defined(ZTS)
+#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
PHP_FUNCTION(chroot);
#endif
PHP_FUNCTION(getcwd);