diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_config.c | 4 | ||||
| -rw-r--r-- | src/sp_config_keywords.c | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/sp_config.c b/src/sp_config.c index 34657e5..563327e 100644 --- a/src/sp_config.c +++ b/src/sp_config.c | |||
| @@ -6,12 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | static zend_result sp_process_config_root(sp_parsed_keyword *parsed_rule) { | 8 | static zend_result sp_process_config_root(sp_parsed_keyword *parsed_rule) { |
| 9 | sp_config_keyword sp_func[] = { | 9 | const sp_config_keyword sp_func[] = { |
| 10 | {parse_unserialize, SP_TOKEN_UNSERIALIZE_HMAC, &(SPCFG(unserialize))}, | 10 | {parse_unserialize, SP_TOKEN_UNSERIALIZE_HMAC, &(SPCFG(unserialize))}, |
| 11 | {parse_unserialize_noclass, SP_TOKEN_UNSERIALIZE_NOCLASS, &(SPCFG(unserialize_noclass))}, | 11 | {parse_unserialize_noclass, SP_TOKEN_UNSERIALIZE_NOCLASS, &(SPCFG(unserialize_noclass))}, |
| 12 | {parse_enable, SP_TOKEN_HARDEN_RANDOM, &(SPCFG(random).enable)}, | 12 | {parse_enable, SP_TOKEN_HARDEN_RANDOM, &(SPCFG(random).enable)}, |
| 13 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, | 13 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, |
| 14 | {parse_uint, SP_TOKEN_LOG_MAX_LEN, &(SPCFG(log_max_len))}, | 14 | {parse_uint, SP_TOKEN_LOG_MAX_LEN, &(SPCFG(log_max_len))}, |
| 15 | {parse_disabled_functions, SP_TOKEN_DISABLE_FUNC, NULL}, | 15 | {parse_disabled_functions, SP_TOKEN_DISABLE_FUNC, NULL}, |
| 16 | {parse_readonly_exec, SP_TOKEN_READONLY_EXEC, &(SPCFG(readonly_exec))}, | 16 | {parse_readonly_exec, SP_TOKEN_READONLY_EXEC, &(SPCFG(readonly_exec))}, |
| 17 | {parse_enable, SP_TOKEN_GLOBAL_STRICT, &(SPCFG(global_strict).enable)}, | 17 | {parse_enable, SP_TOKEN_GLOBAL_STRICT, &(SPCFG(global_strict).enable)}, |
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 1a23658..21b8607 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | SP_PARSE_FN(parse_enable) { | 15 | SP_PARSE_FN(parse_enable) { |
| 16 | bool enable = false, disable = false; | 16 | bool enable = false, disable = false; |
| 17 | sp_config_keyword config_keywords[] = { | 17 | const sp_config_keyword config_keywords[] = { |
| 18 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 18 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 19 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 19 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 20 | {0, 0, 0}}; | 20 | {0, 0, 0}}; |
| @@ -29,7 +29,7 @@ SP_PARSE_FN(parse_enable) { | |||
| 29 | SP_PARSE_FN(parse_session) { | 29 | SP_PARSE_FN(parse_session) { |
| 30 | sp_config_session *cfg = retval; | 30 | sp_config_session *cfg = retval; |
| 31 | 31 | ||
| 32 | sp_config_keyword config_keywords[] = { | 32 | const sp_config_keyword config_keywords[] = { |
| 33 | {parse_empty, SP_TOKEN_ENCRYPT, &(cfg->encrypt)}, | 33 | {parse_empty, SP_TOKEN_ENCRYPT, &(cfg->encrypt)}, |
| 34 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, | 34 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, |
| 35 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, | 35 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, |
| @@ -86,7 +86,7 @@ SP_PARSE_FN(parse_unserialize_noclass) { | |||
| 86 | bool enable = false, disable = false; | 86 | bool enable = false, disable = false; |
| 87 | sp_config_unserialize_noclass *cfg = (sp_config_unserialize_noclass*)retval; | 87 | sp_config_unserialize_noclass *cfg = (sp_config_unserialize_noclass*)retval; |
| 88 | 88 | ||
| 89 | sp_config_keyword config_keywords[] = { | 89 | const sp_config_keyword config_keywords[] = { |
| 90 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 90 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 91 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 91 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 92 | {0, 0, 0}}; | 92 | {0, 0, 0}}; |
| @@ -104,7 +104,7 @@ SP_PARSE_FN(parse_unserialize) { | |||
| 104 | bool enable = false, disable = false; | 104 | bool enable = false, disable = false; |
| 105 | sp_config_unserialize *cfg = (sp_config_unserialize*)retval; | 105 | sp_config_unserialize *cfg = (sp_config_unserialize*)retval; |
| 106 | 106 | ||
| 107 | sp_config_keyword config_keywords[] = { | 107 | const sp_config_keyword config_keywords[] = { |
| 108 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 108 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 109 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 109 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 110 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, | 110 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, |
| @@ -125,7 +125,7 @@ SP_PARSE_FN(parse_readonly_exec) { | |||
| 125 | bool enable = false, disable = false, xchecks = false, no_xchecks = false; | 125 | bool enable = false, disable = false, xchecks = false, no_xchecks = false; |
| 126 | sp_config_readonly_exec *cfg = (sp_config_readonly_exec*)retval; | 126 | sp_config_readonly_exec *cfg = (sp_config_readonly_exec*)retval; |
| 127 | 127 | ||
| 128 | sp_config_keyword config_keywords[] = { | 128 | const sp_config_keyword config_keywords[] = { |
| 129 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 129 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 130 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 130 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 131 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, | 131 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, |
| @@ -148,7 +148,7 @@ SP_PARSE_FN(parse_readonly_exec) { | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | SP_PARSE_FN(parse_global) { | 150 | SP_PARSE_FN(parse_global) { |
| 151 | sp_config_keyword config_keywords[] = { | 151 | const sp_config_keyword config_keywords[] = { |
| 152 | {parse_str, SP_TOKEN_ENCRYPTION_KEY, &(SPCFG(encryption_key))}, | 152 | {parse_str, SP_TOKEN_ENCRYPTION_KEY, &(SPCFG(encryption_key))}, |
| 153 | {parse_str, SP_TOKEN_ENV_VAR, &(SPCFG(cookies_env_var))}, | 153 | {parse_str, SP_TOKEN_ENV_VAR, &(SPCFG(cookies_env_var))}, |
| 154 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, | 154 | {parse_log_media, SP_TOKEN_LOG_MEDIA, &(SPCFG(log_media))}, |
| @@ -178,7 +178,7 @@ SP_PARSE_FN(parse_global) { | |||
| 178 | SP_PARSE_FN(parse_eval_filter_conf) { | 178 | SP_PARSE_FN(parse_eval_filter_conf) { |
| 179 | sp_config_eval *cfg = &(SPCFG(eval)); | 179 | sp_config_eval *cfg = &(SPCFG(eval)); |
| 180 | 180 | ||
| 181 | sp_config_keyword config_keywords[] = { | 181 | const sp_config_keyword config_keywords[] = { |
| 182 | {parse_list, SP_TOKEN_LIST, retval}, | 182 | {parse_list, SP_TOKEN_LIST, retval}, |
| 183 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, | 183 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, |
| 184 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, | 184 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, |
| @@ -195,7 +195,7 @@ SP_PARSE_FN(parse_eval_filter_conf) { | |||
| 195 | SP_PARSE_FN(parse_wrapper_whitelist) { | 195 | SP_PARSE_FN(parse_wrapper_whitelist) { |
| 196 | sp_config_wrapper *cfg = (sp_config_wrapper*)retval; | 196 | sp_config_wrapper *cfg = (sp_config_wrapper*)retval; |
| 197 | 197 | ||
| 198 | sp_config_keyword config_keywords[] = { | 198 | const sp_config_keyword config_keywords[] = { |
| 199 | {parse_list, SP_TOKEN_LIST, &cfg->whitelist}, | 199 | {parse_list, SP_TOKEN_LIST, &cfg->whitelist}, |
| 200 | {parse_list, SP_TOKEN_ALLOW_PHP_STREAMS, &cfg->php_stream_allowlist}, | 200 | {parse_list, SP_TOKEN_ALLOW_PHP_STREAMS, &cfg->php_stream_allowlist}, |
| 201 | {0, 0, 0}}; | 201 | {0, 0, 0}}; |
| @@ -211,7 +211,7 @@ SP_PARSE_FN(parse_cookie) { | |||
| 211 | zend_string *samesite = NULL; | 211 | zend_string *samesite = NULL; |
| 212 | sp_cookie *cookie = pecalloc(1, sizeof(sp_cookie), 1); | 212 | sp_cookie *cookie = pecalloc(1, sizeof(sp_cookie), 1); |
| 213 | 213 | ||
| 214 | sp_config_keyword config_keywords[] = { | 214 | const sp_config_keyword config_keywords[] = { |
| 215 | {parse_str, SP_TOKEN_NAME, &(cookie->name)}, | 215 | {parse_str, SP_TOKEN_NAME, &(cookie->name)}, |
| 216 | {parse_regexp, SP_TOKEN_NAME_REGEXP, &(cookie->name_r)}, | 216 | {parse_regexp, SP_TOKEN_NAME_REGEXP, &(cookie->name_r)}, |
| 217 | {parse_str, SP_TOKEN_SAMESITE, &samesite}, | 217 | {parse_str, SP_TOKEN_SAMESITE, &samesite}, |
| @@ -313,7 +313,7 @@ SP_PARSE_FN(parse_disabled_functions) { | |||
| 313 | sp_disabled_function *df = pecalloc(1, sizeof(*df), 1); | 313 | sp_disabled_function *df = pecalloc(1, sizeof(*df), 1); |
| 314 | df->pos = -1; | 314 | df->pos = -1; |
| 315 | 315 | ||
| 316 | sp_config_keyword config_keywords[] = { | 316 | const sp_config_keyword config_keywords[] = { |
| 317 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 317 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 318 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 318 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 319 | {parse_str, SP_TOKEN_ALIAS, &(df->alias)}, | 319 | {parse_str, SP_TOKEN_ALIAS, &(df->alias)}, |
| @@ -456,7 +456,7 @@ SP_PARSE_FN(parse_upload_validation) { | |||
| 456 | bool disable = false, enable = false; | 456 | bool disable = false, enable = false; |
| 457 | sp_config_upload_validation *cfg = (sp_config_upload_validation*)retval; | 457 | sp_config_upload_validation *cfg = (sp_config_upload_validation*)retval; |
| 458 | 458 | ||
| 459 | sp_config_keyword config_keywords[] = { | 459 | const sp_config_keyword config_keywords[] = { |
| 460 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, | 460 | {parse_empty, SP_TOKEN_ENABLE, &(enable)}, |
| 461 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, | 461 | {parse_empty, SP_TOKEN_DISABLE, &(disable)}, |
| 462 | {parse_str, SP_TOKEN_UPLOAD_SCRIPT, &(cfg->script)}, | 462 | {parse_str, SP_TOKEN_UPLOAD_SCRIPT, &(cfg->script)}, |
| @@ -482,7 +482,7 @@ SP_PARSE_FN(parse_ini_protection) { | |||
| 482 | bool disable = false, enable = false; | 482 | bool disable = false, enable = false; |
| 483 | bool rw = false, ro = false; // rw is ignored, but declaring .policy_rw is valid for readability | 483 | bool rw = false, ro = false; // rw is ignored, but declaring .policy_rw is valid for readability |
| 484 | sp_config_ini *cfg = (sp_config_ini*)retval; | 484 | sp_config_ini *cfg = (sp_config_ini*)retval; |
| 485 | sp_config_keyword config_keywords[] = { | 485 | const sp_config_keyword config_keywords[] = { |
| 486 | {parse_empty, "enable", &(enable)}, | 486 | {parse_empty, "enable", &(enable)}, |
| 487 | {parse_empty, "disable", &(disable)}, | 487 | {parse_empty, "disable", &(disable)}, |
| 488 | {parse_empty, "simulation", &cfg->simulation}, | 488 | {parse_empty, "simulation", &cfg->simulation}, |
| @@ -518,7 +518,7 @@ SP_PARSE_FN(parse_ini_entry) { | |||
| 518 | sp_ini_entry *entry = pecalloc(1, sizeof(sp_ini_entry), 1); | 518 | sp_ini_entry *entry = pecalloc(1, sizeof(sp_ini_entry), 1); |
| 519 | bool rw = false, ro = false; | 519 | bool rw = false, ro = false; |
| 520 | 520 | ||
| 521 | sp_config_keyword config_keywords[] = { | 521 | const sp_config_keyword config_keywords[] = { |
| 522 | {parse_empty, "simulation", &entry->simulation}, | 522 | {parse_empty, "simulation", &entry->simulation}, |
| 523 | {parse_empty, "sim", &entry->simulation}, | 523 | {parse_empty, "sim", &entry->simulation}, |
| 524 | {parse_str, "key", &entry->key}, | 524 | {parse_str, "key", &entry->key}, |
