22static char **limit_extensions =
NULL;
24static int fpm_php_zend_ini_alter_master(
char *
name,
int name_length,
char *new_value,
int new_value_length,
int mode,
int stage)
29 if ((ini_entry = zend_hash_str_find_ptr(
EG(ini_directives),
name, name_length)) ==
NULL) {
33 duplicate = zend_string_init(new_value, new_value_length, 1);
35 if (!ini_entry->on_modify
36 || ini_entry->on_modify(ini_entry, duplicate,
38 ini_entry->
value = duplicate;
51static void fpm_php_disable(
char *
value,
int (*zend_disable)(
const char *,
size_t))
61 zend_disable(
s, e -
s);
75 zend_disable(
s, e -
s);
80#define FPM_PHP_INI_ALTERING_ERROR -1
81#define FPM_PHP_INI_APPLIED 1
82#define FPM_PHP_INI_EXTENSION_FAILED 0
83#define FPM_PHP_INI_EXTENSION_LOADED 2
98 bool orig_rc_debug = zend_rc_debug;
102 zend_rc_debug =
false;
108 zend_rc_debug = orig_rc_debug;
126 PG(disable_classes) =
v;
179 char max_workers[10 + 1];
193 return SG(request_info).path_translated;
198 return (
char *)
SG(request_info).request_uri;
203 return (
char *)
SG(request_info).request_method;
208 return SG(request_info).query_string;
213 return SG(request_info).auth_user;
218 return SG(request_info).content_length;
221static void fpm_php_cleanup(
int which,
void *
arg)
225 if (limit_extensions) {
246 if (0 > fpm_php_apply_defines(wp) ||
247 0 > fpm_php_set_allowed_clients(wp)) {
265 if (!path || !limit_extensions) {
269 p = limit_extensions;
273 if (path_len > ext_len) {
274 char *path_ext = path + path_len - ext_len;
275 if (
strcmp(*
p, path_ext) == 0) {
283 zlog(
ZLOG_NOTICE,
"Access to the script '%s' has been denied (see security.limit_extensions)", path);
307 if (str && zend_string_equals_cstr(str,
key, key_len)) {
SAPI_API void sapi_shutdown(void)
PHPAPI void php_dl(const char *file, int type, zval *return_value, int start_now)
void fcgi_set_mgmt_var(const char *name, size_t name_len, const char *value, size_t value_len)
void fcgi_terminate(void)
void fcgi_set_allowed_clients(char *ip)
int fpm_cleanup_add(int type, void(*cleanup)(int, void *), void *arg)
#define FPM_PHP_INI_EXTENSION_FAILED
char * fpm_php_script_filename(void)
size_t fpm_php_content_length(void)
char * fpm_php_request_method(void)
char * fpm_php_query_string(void)
int fpm_php_limit_extensions(char *path)
char * fpm_php_request_uri(void)
#define FPM_PHP_INI_ALTERING_ERROR
int fpm_php_init_main(void)
#define FPM_PHP_INI_EXTENSION_LOADED
#define FPM_PHP_INI_APPLIED
char * fpm_php_auth_user(void)
bool fpm_php_is_key_in_table(zend_string *table, const char *key, size_t key_len)
void fpm_php_soft_quit(void)
int fpm_php_init_child(struct fpm_worker_pool_s *wp)
int fpm_php_apply_defines_ex(struct key_value_s *kv, int mode)
void fpm_worker_pool_free_limit_extensions(char **limit_extensions)
void php_module_shutdown(void)
#define PHP_INI_STAGE_ACTIVATE
unsigned char key[REFLECTION_KEY_LEN]
struct key_value_s * php_admin_values
struct key_value_s * php_values
char * listen_allowed_clients
struct fpm_worker_pool_config_s * config
enum fpm_address_domain listen_address_domain
struct key_value_s * next
ZEND_API void zend_collect_module_handlers(void)
ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_name_length)
ZEND_API void zend_disable_functions(const char *function_list)
extension_loaded(string $extension)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
ZEND_API bool zend_is_auto_global(zend_string *name)
struct _zend_ini_entry zend_ini_entry
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
#define ZEND_HASH_FOREACH_END()
#define ZEND_HASH_FOREACH_STR_KEY(ht, _key)
struct _zend_string zend_string
#define MODULE_PERSISTENT
ZEND_API void zend_interned_strings_switch_storage(bool request)
#define Z_ARRVAL_P(zval_p)