Re: cvs: php4 /ext/standard basic_functions.c dir.c php_dir.h
| From: | Andi Gutmans | Date: | Wed, 14 Feb 2001 20:54:01 +0000 |
| Subject: | Re: cvs: php4 /ext/standard basic_functions.c dir.c php_dir.h | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-4024@lists.php.net to get a copy of this message | ||
Derick,
You should not enable this function if ZEND_WIN32 is defined or ZTS=1 (Thread Safety).
Andi
At 10:48 AM 2/14/2001 +0000, Derick Rethans wrote:
derick Wed Feb 14 02:48:49 2001 EDTModified files:/php4/ext/standard basic_functions.c dir.c php_dir.hLog: - Added the chroot function for changing root in a script. #- This can be usefull when using PHP in a shell environment, or when PHP # runs as CGI which needs a little more security Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.302 php4/ext/standard/basic_functions.c:1.303 --- php4/ext/standard/basic_functions.c:1.302 Mon Feb 5 13:59:16 2001 +++ php4/ext/standard/basic_functions.c Wed Feb 14 02:48:48 2001 @@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: basic_functions.c,v 1.302 2001/02/05 21:59:16 zeev Exp $ */ +/* $Id: basic_functions.c,v 1.303 2001/02/14 10:48:48 derick Exp $ */ #include "php.h" #include "php_main.h" @@ -465,6 +465,7 @@PHP_FE(opendir, NULL) PHP_FE(closedir, NULL) PHP_FE(chdir, NULL) + PHP_FE(chroot, NULL) PHP_FE(getcwd, NULL) PHP_FE(rewinddir, NULL) PHP_STATIC_FE("readdir", php_if_readdir, NULL)Index: php4/ext/standard/dir.c diff -u php4/ext/standard/dir.c:1.52 php4/ext/standard/dir.c:1.53--- php4/ext/standard/dir.c:1.52 Sat Dec 16 12:52:43 2000 +++ php4/ext/standard/dir.c Wed Feb 14 02:48:48 2001@@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: dir.c,v 1.52 2000/12/16 20:52:43 andi Exp $ */ +/* $Id: dir.c,v 1.53 2001/02/14 10:48:48 derick Exp $ */ /* {{{ includes/startup/misc */ @@ -219,6 +219,30 @@if (dirp->id == DIRG(default_dir)) { php_set_default_dir(-1 DIRLS_CC); }+} + +/* }}} */ +/* {{{ proto int chroot(string directory) + Change root directory */ + +PHP_FUNCTION(chroot) +{+ pval **arg; + int ret;++ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_string_ex(arg);++ ret = chroot((*arg)->value.str.val);++ if (ret != 0) { + php_error(E_WARNING, "chroot: %s (errno %d)", strerror(errno), errno); + RETURN_FALSE; + }++ RETURN_TRUE;} /* }}} */ Index: php4/ext/standard/php_dir.h diff -u php4/ext/standard/php_dir.h:1.11 php4/ext/standard/php_dir.h:1.12--- php4/ext/standard/php_dir.h:1.11 Thu Dec 7 04:09:38 2000+++ php4/ext/standard/php_dir.h Wed Feb 14 02:48:48 2001 @@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: php_dir.h,v 1.11 2000/12/07 12:09:38 sas Exp $ */ +/* $Id: php_dir.h,v 1.12 2001/02/14 10:48:48 derick Exp $ */ #ifndef PHP_DIR_H #define PHP_DIR_H @@ -28,6 +28,7 @@ PHP_FUNCTION(opendir); PHP_FUNCTION(closedir); PHP_FUNCTION(chdir); +PHP_FUNCTION(chroot); PHP_FUNCTION(getcwd); PHP_FUNCTION(rewinddir); PHP_NAMED_FUNCTION(php_if_readdir); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net