Re: Function that checks if filename passes PHP security checks -- does it exist?
| From: | Rasmus Lerdorf | Date: | Thu, 14 Apr 2005 02:24:17 +0000 |
| Subject: | Re: Function that checks if filename passes PHP security checks -- does it exist? | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2270@lists.php.net to get a copy of this message | ||
O. Watson wrote:
I searched the PHP source for anything looking like a filename verifier (as in verify that this filename passess all currently turned on PHP security checks), without success. Is there such a function available to extension writers? I don't want to have to try to open the file using php_stream_open_wrapper() just to see whether it fails.Use this: if (PG(safe_mode) && !php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
RETURN_FALSE;} if (php_check_open_basedir(filename TSRMLS_CC)) {
RETURN_FALSE;} See main/safemode.c for more info. -Rasmus