summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sp_config.h1
-rw-r--r--src/sp_config_keywords.c12
-rw-r--r--src/tests/broken_conf_mutually_exclusive7.phpt2
3 files changed, 8 insertions, 7 deletions
diff --git a/src/sp_config.h b/src/sp_config.h
index ac33eb5..e14e30b 100644
--- a/src/sp_config.h
+++ b/src/sp_config.h
@@ -94,7 +94,6 @@ typedef struct {
94 sp_node_t *var_array_keys; 94 sp_node_t *var_array_keys;
95 95
96 bool allow; 96 bool allow;
97 bool drop;
98 97
99 char *var; 98 char *var;
100 99
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c
index 569542c..416aaef 100644
--- a/src/sp_config_keywords.c
+++ b/src/sp_config_keywords.c
@@ -143,7 +143,7 @@ int parse_cookie_encryption(char *line) {
143 143
144int parse_disabled_functions(char *line) { 144int parse_disabled_functions(char *line) {
145 int ret = 0; 145 int ret = 0;
146 bool enable = true, disable = false; 146 bool enable = true, disable = false, allow = false, drop = false;
147 char *pos = NULL; 147 char *pos = NULL;
148 char *line_number = NULL; 148 char *line_number = NULL;
149 sp_disabled_function *df = pecalloc(sizeof(*df), 1, 1); 149 sp_disabled_function *df = pecalloc(sizeof(*df), 1, 1);
@@ -159,8 +159,8 @@ int parse_disabled_functions(char *line) {
159 {parse_str, SP_TOKEN_FUNCTION, &(df->function)}, 159 {parse_str, SP_TOKEN_FUNCTION, &(df->function)},
160 {parse_regexp, SP_TOKEN_FUNCTION_REGEXP, &(df->r_function)}, 160 {parse_regexp, SP_TOKEN_FUNCTION_REGEXP, &(df->r_function)},
161 {parse_str, SP_TOKEN_DUMP, &(df->dump)}, 161 {parse_str, SP_TOKEN_DUMP, &(df->dump)},
162 {parse_empty, SP_TOKEN_ALLOW, &(df->allow)}, 162 {parse_empty, SP_TOKEN_ALLOW, &(allow)},
163 {parse_empty, SP_TOKEN_DROP, &(df->drop)}, 163 {parse_empty, SP_TOKEN_DROP, &(drop)},
164 {parse_str, SP_TOKEN_HASH, &(df->hash)}, 164 {parse_str, SP_TOKEN_HASH, &(df->hash)},
165 {parse_str, SP_TOKEN_PARAM, &(df->param)}, 165 {parse_str, SP_TOKEN_PARAM, &(df->param)},
166 {parse_regexp, SP_TOKEN_VALUE_REGEXP, &(df->value_r)}, 166 {parse_regexp, SP_TOKEN_VALUE_REGEXP, &(df->value_r)},
@@ -224,10 +224,10 @@ int parse_disabled_functions(char *line) {
224 " must take a function name on line %zu.", 224 " must take a function name on line %zu.",
225 line, sp_line_no); 225 line, sp_line_no);
226 return -1; 226 return -1;
227 } else if (!(df->allow ^ df->drop)) { 227 } else if (!(allow ^ drop)) {
228 sp_log_err("config", 228 sp_log_err("config",
229 "Invalid configuration line: 'sp.disabled_functions%s': The " 229 "Invalid configuration line: 'sp.disabled_functions%s': The "
230 "rule must either be a `drop` or and `allow` one on line %zu.", 230 "rule must either be a `drop` or `allow` one on line %zu.",
231 line, sp_line_no); 231 line, sp_line_no);
232 return -1; 232 return -1;
233 } 233 }
@@ -254,6 +254,8 @@ int parse_disabled_functions(char *line) {
254 } 254 }
255 } 255 }
256 256
257 df->allow = allow;
258
257 if (df->function) { 259 if (df->function) {
258 df->functions_list = parse_functions_list(df->function); 260 df->functions_list = parse_functions_list(df->function);
259 } 261 }
diff --git a/src/tests/broken_conf_mutually_exclusive7.phpt b/src/tests/broken_conf_mutually_exclusive7.phpt
index 419cfd4..d9507f6 100644
--- a/src/tests/broken_conf_mutually_exclusive7.phpt
+++ b/src/tests/broken_conf_mutually_exclusive7.phpt
@@ -6,4 +6,4 @@ Broken configuration
6sp.configuration_file={PWD}/config/broken_conf_mutually_exclusive7.ini 6sp.configuration_file={PWD}/config/broken_conf_mutually_exclusive7.ini
7--FILE-- 7--FILE--
8--EXPECT-- 8--EXPECT--
9[snuffleupagus][0.0.0.0][config][error] Invalid configuration line: 'sp.disabled_functions.function("system").ret("0").drop().allow();': The rule must either be a `drop` or and `allow` one on line 1. \ No newline at end of file 9[snuffleupagus][0.0.0.0][config][error] Invalid configuration line: 'sp.disabled_functions.function("system").ret("0").drop().allow();': The rule must either be a `drop` or `allow` one on line 1.