PHP3, Secure Environment (Virtual Hosts)

From: Date: Sat, 22 Jan 2000 01:03:05 +0000
Subject: PHP3, Secure Environment (Virtual Hosts)
Groups: php.dev 
Request: Send a blank email to php-dev+get-14816@lists.php.net to get a copy of this message
I'm currently trying to patch php3 so that each script on a virtual host can only access files which are in the document root (...and below) of the virtual host My Idea is to patch all functions which do something with directories or files. Look at this example: ---cut on--- void php3_chdir(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; int ret; TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string(arg); /***** SECURITY *****/ if (check_dir_security(arg->value.str.val)) RETURN_FALSE; /***** END *****/ ret = chdir(arg->value.str.val); if (ret < 0) { php3_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno); RETURN_FALSE; } RETURN_TRUE; } --- cut off--- Does anybody of you knows a better way? I think chroot() is not possible. Sorry for my bad english, but I think you should understand what I mean. M. Bischof ByteWorks, Switzerland

« previous php.dev (#14816) next »