28# define REGEX_MODE (REG_EXTENDED|REG_NOSUB|REG_ICASE)
30# define REGEX_MODE (REG_EXTENDED|REG_NOSUB)
43#define ZEND_BLACKLIST_BLOCK_SIZE 32
69static void blacklist_report_regexp_error(
const char *pcre_error,
int pcre_error_offset)
74static void zend_accel_blacklist_update_regexp(
zend_blacklist *blacklist)
80 char regexp[12*1024], *
p, *
end, *c, *backtrack =
NULL;
83 if (blacklist->
pos == 0) {
93 end = regexp +
sizeof(regexp) -
sizeof(
"[^\\\\]*)\0");
95 for (i = 0; i < blacklist->
pos; ) {
98 while (*c &&
p <
end) {
163 if (*c || i == blacklist->
pos - 1) {
184 blacklist_report_regexp_error((
char *)pcre_error, pcre_error_offset);
187#ifdef HAVE_PCRE_JIT_SUPPORT
198 *regexp_list_it = it;
199 regexp_list_it = &it->
next;
232static inline void zend_accel_blacklist_allocate(
zend_blacklist *blacklist)
234 if (blacklist->
pos == blacklist->
size) {
240static void zend_accel_blacklist_loadone(
zend_blacklist *blacklist,
char *filename)
244 int path_length, blacklist_path_length = 0;
246 if ((fp =
fopen(filename,
"r")) ==
NULL) {
259 memset(real_path, 0,
sizeof(real_path));
262 char *path_dup, *pbuf;
264 if (path_length > 0 &&
buf[path_length - 1] ==
'\n') {
265 buf[--path_length] = 0;
266 if (path_length > 0 &&
buf[path_length - 1] ==
'\r') {
267 buf[--path_length] = 0;
273 while (*pbuf ==
'\r') {
279 if (path_length > 0 && pbuf[0] ==
'\"' && pbuf[path_length - 1]==
'\"') {
284 if (path_length <= 0) {
294 if (blacklist_path) {
299 path_length =
strlen(real_path);
303 zend_accel_blacklist_allocate(blacklist);
305 blacklist->
entries[blacklist->
pos].
path = (
char *)malloc(path_length + 1);
316 if (blacklist_path) {
317 free(blacklist_path);
338 for(i=0 ; i<globbuf.
gl_pathc; i++) {
339 zend_accel_blacklist_loadone(blacklist, globbuf.
gl_pathv[i]);
344 zend_accel_blacklist_loadone(blacklist, filename);
346 zend_accel_blacklist_update_regexp(blacklist);
355 if (regexp_list_it ==
NULL) {
358 while (regexp_list_it !=
NULL) {
371 regexp_list_it = regexp_list_it->
next;
380 for (i = 0; i < blacklist->
pos; i++) {
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
glob(string $pattern, int $flags=0)
fgets($stream, ?int $length=null)
memset(ptr, 0, type->size)
zend_ffi_ctype_name_buf buf
PHPAPI char * expand_filepath(const char *filepath, char *real_path)
PHPAPI char * expand_filepath_ex(const char *filepath, char *real_path, const char *relative_to, size_t relative_to_len)
PHPAPI void globfree(glob_t *pglob)
#define pcre2_get_error_message
#define pcre2_match_context
#define PCRE2_JIT_COMPLETE
#define PCRE2_NO_AUTO_CAPTURE
#define pcre2_jit_compile
#define pcre2_compile_context
unsigned const char * end
PHPAPI pcre2_match_context * php_pcre_mctx(void)
PHPAPI pcre2_compile_context * php_pcre_cctx(void)
PHPAPI pcre2_match_data * php_pcre_create_match_data(uint32_t capture_count, pcre2_code *re)
PHPAPI void php_pcre_free_match_data(pcre2_match_data *match_data)
zend_regexp_list * regexp_list
zend_blacklist_entry * entries
#define ZEND_BLACKLIST_BLOCK_SIZE
bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len)
void zend_accel_blacklist_shutdown(zend_blacklist *blacklist)
void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename)
void zend_accel_blacklist_init(zend_blacklist *blacklist)
void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument)
zend_blacklist accel_blacklist
int(* blacklist_apply_func_arg_t)(zend_blacklist_entry *, zval *)
struct _zend_blacklist zend_blacklist
struct _zend_blacklist_entry zend_blacklist_entry
struct _zend_regexp_list zend_regexp_list
ZEND_NORETURN void zend_accel_error_noreturn(int type, const char *format,...)
void zend_accel_error(int type, const char *format,...)
#define ACCEL_LOG_WARNING
ZEND_API char *ZEND_FASTCALL zend_strndup(const char *s, size_t length)
ZEND_API size_t zend_dirname(char *path, size_t len)
#define VCWD_REALPATH(path, real_path)