From 5275b603987d197daa8318b55d6a9118c83a7fde Mon Sep 17 00:00:00 2001 From: foobar Date: Wed, 12 Sep 2001 02:07:46 +0000 Subject: [PATCH] Enable chroot() only if SAPI is CGI. --- ext/standard/basic_functions.c | 2 +- ext/standard/config.m4 | 4 ++++ ext/standard/dir.c | 2 +- ext/standard/php_dir.h | 2 +- 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); -- 2.50.1