summaryrefslogtreecommitdiff
path: root/src/sp_config_keywords.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp_config_keywords.c')
-rw-r--r--src/sp_config_keywords.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c
index ea4e1cd..fa26635 100644
--- a/src/sp_config_keywords.c
+++ b/src/sp_config_keywords.c
@@ -228,9 +228,32 @@ SP_PARSE_FN(parse_cookie) {
228 ZSTR_VAL(samesite), parsed_rule->lineno); 228 ZSTR_VAL(samesite), parsed_rule->lineno);
229 goto err; 229 goto err;
230 } 230 }
231 zend_string_release(samesite);
232 samesite = NULL;
231 } 233 }
232 234
233 SPCFG(cookie).cookies = sp_list_insert(SPCFG(cookie).cookies, cookie); 235 // find other cookie entry with identical name or name_r
236 sp_cookie *entry = NULL;
237 sp_list_node *pList = NULL;
238 for (pList = SPCFG(cookie).cookies; pList; pList = pList->next) {
239 entry = pList->data;
240 if (!entry) { continue; }
241 if ((entry->name && cookie->name && sp_zend_string_equals(entry->name, cookie->name)) ||
242 (entry->name_r && cookie->name_r && sp_zend_string_equals(entry->name_r->pattern, cookie->name_r->pattern))) {
243 break;
244 }
245 }
246 if (pList && entry) {
247 // override cookie settings if set
248 if (cookie->samesite) { entry->samesite = cookie->samesite; }
249 if (cookie->encrypt) { entry->encrypt = cookie->encrypt; }
250 if (cookie->simulation) { entry->simulation = cookie->simulation; }
251 sp_free_cookie(cookie);
252 pefree(cookie, 1);
253 cookie = NULL;
254 } else {
255 SPCFG(cookie).cookies = sp_list_insert(SPCFG(cookie).cookies, cookie);
256 }
234 257
235 return SP_PARSER_STOP; 258 return SP_PARSER_STOP;
236 259
@@ -492,6 +515,11 @@ SP_PARSE_FN(parse_ini_entry) {
492 goto err; 515 goto err;
493 } 516 }
494 517
518 if (zend_hash_find_ptr(SPCFG(ini).entries, entry->key)) {
519 sp_log_err("config", "duplicate INI key '%s' on line %zu", ZSTR_VAL(entry->key), parsed_rule->lineno);
520 goto err;
521 }
522
495 if (ro && rw) { 523 if (ro && rw) {
496 sp_log_err("config", "rule cannot be both read-write and read-only on line %zu", parsed_rule->lineno); 524 sp_log_err("config", "rule cannot be both read-write and read-only on line %zu", parsed_rule->lineno);
497 goto err; 525 goto err;