From 69b95a117957ceaab16f5dfb68a41500a7958ba9 Mon Sep 17 00:00:00 2001 From: crKontrol Date: Thu, 2 Aug 2018 14:41:20 +0200 Subject: fix #203 (#204) sp.disable_function.function().filename doesn't take phar:///--- src/sp_config_keywords.c | 16 ++++++++++------ src/tests/broken_conf_invalid_filename.phpt | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 8e1c2dc..fb20a43 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c @@ -278,7 +278,8 @@ int parse_cookie(char *line) { return -1; } } - SNUFFLEUPAGUS_G(config).config_cookie->cookies = + SNUFFLEUPAGUS_G(config) + .config_cookie->cookies = sp_list_insert(SNUFFLEUPAGUS_G(config).config_cookie->cookies, cookie); return SUCCESS; } @@ -392,11 +393,14 @@ int parse_disabled_functions(char *line) { " must take a function name on line %zu.", line, sp_line_no); return -1; - } else if (df->filename && *ZSTR_VAL(df->filename) != '/') { - sp_log_err("config", - "Invalid configuration line: 'sp.disabled_functions%s':" - "'.filename' must be an absolute path on line %zu.", - line, sp_line_no); + } else if (df->filename && (*ZSTR_VAL(df->filename) != '/') && + (0 != + strncmp(ZSTR_VAL(df->filename), "phar://", strlen("phar://")))) { + sp_log_err( + "config", + "Invalid configuration line: 'sp.disabled_functions%s':" + "'.filename' must be an absolute path or a phar archive on line %zu.", + line, sp_line_no); return -1; } else if (!(allow ^ drop)) { sp_log_err("config", diff --git a/src/tests/broken_conf_invalid_filename.phpt b/src/tests/broken_conf_invalid_filename.phpt index 61b967b..a1515a7 100644 --- a/src/tests/broken_conf_invalid_filename.phpt +++ b/src/tests/broken_conf_invalid_filename.phpt @@ -6,4 +6,4 @@ Broken configuration filename without absolute path sp.configuration_file={PWD}/config/broken_conf_invalid_filename.ini --FILE-- --EXPECTF-- -[snuffleupagus][0.0.0.0][config][error] Invalid configuration line: 'sp.disabled_functions.function("sprintf").filename("wrong file name").drop();':'.filename' must be an absolute path on line 1. +[snuffleupagus][0.0.0.0][config][error] Invalid configuration line: 'sp.disabled_functions.function("sprintf").filename("wrong file name").drop();':'.filename' must be an absolute path or a phar archive on line 1. -- cgit v1.3