summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-09-02 13:58:01 +0200
committerBen Fuhrmannek2021-09-02 13:58:01 +0200
commitb4dcbe2dd11efda09adc934fa2563eafc12e9b55 (patch)
treed4b18b69f24c43a91ffee55caa8f6fbcef240687 /src
parent782336d8f4b9c411d344c0e7752e87631952f268 (diff)
fixed compiler warnings + test cases
Diffstat (limited to 'src')
-rw-r--r--src/sp_config_keywords.c2
-rw-r--r--src/sp_config_scanner.cached.c14
-rw-r--r--src/sp_config_scanner.re14
-rw-r--r--src/tests/broken_configuration_php8/broken_conf_cookie_encryption_without_env_var.phpt2
-rw-r--r--src/tests/cookies_encryption_warning/encrypt_cookies_no_env.phpt2
-rw-r--r--src/tests/cookies_encryption_warning/encrypt_regexp_cookies_no_env.phpt2
6 files changed, 18 insertions, 18 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c
index fd90453..3b6bc0b 100644
--- a/src/sp_config_keywords.c
+++ b/src/sp_config_keywords.c
@@ -183,7 +183,7 @@ SP_PARSE_FN(parse_cookie) {
183 if (cookie->encrypt) { 183 if (cookie->encrypt) {
184 if (!SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var) { 184 if (!SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var) {
185 sp_log_err("config", "You're trying to use the cookie encryption feature on line %zu " 185 sp_log_err("config", "You're trying to use the cookie encryption feature on line %zu "
186 "without having set the `." SP_TOKEN_ENV_VAR "` option in`sp.global`: please set it first", parsed_rule->lineno); 186 "without having set the `." SP_TOKEN_ENV_VAR "` option in `sp.global`: please set it first", parsed_rule->lineno);
187 goto err; 187 goto err;
188 } else if (!SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key) { 188 } else if (!SNUFFLEUPAGUS_G(config).config_snuffleupagus->encryption_key) {
189 sp_log_err("config", "You're trying to use the cookie encryption feature " 189 sp_log_err("config", "You're trying to use the cookie encryption feature "
diff --git a/src/sp_config_scanner.cached.c b/src/sp_config_scanner.cached.c
index 26a6652..868d271 100644
--- a/src/sp_config_scanner.cached.c
+++ b/src/sp_config_scanner.cached.c
@@ -154,7 +154,7 @@ const char *yyt4;
154 zend_hash_str_add_ptr(&vars, ZEND_STRL("PHP_VERSION_ID"), zend_string_init(ZEND_STRL(ZEND_TOSTR(PHP_VERSION_ID)), 1)); 154 zend_hash_str_add_ptr(&vars, ZEND_STRL("PHP_VERSION_ID"), zend_string_init(ZEND_STRL(ZEND_TOSTR(PHP_VERSION_ID)), 1));
155 155
156 156
157 int cond_res[100] = {0}; 157 int cond_res[100] = {1};
158 int cond_res_i = 0; 158 int cond_res_i = 0;
159 char cond_op[100] = {0}; 159 char cond_op[100] = {0};
160 int cond_op_i = 0; 160 int cond_op_i = 0;
@@ -883,7 +883,7 @@ yy111:
883 if (cond_op_i == 0 || sy_op_peek() != '(') { 883 if (cond_op_i == 0 || sy_op_peek() != '(') {
884 cs_error_log("unbalanced parathesis on line %d", lineno); goto out; 884 cs_error_log("unbalanced parathesis on line %d", lineno); goto out;
885 } 885 }
886 sy_op_pop(); 886 cond_op_i--;
887 goto yyc_cond_op; 887 goto yyc_cond_op;
888 } 888 }
889yy113: 889yy113:
@@ -910,12 +910,12 @@ yy116:
910 case '>': op1 = 'G'; break; // >= 910 case '>': op1 = 'G'; break; // >=
911 } 911 }
912 } 912 }
913 while (cond_op_i && sy_op_peek() != '(' && ((sy_op_precedence(sy_op_peek()) > sy_op_precedence(*t1)) || (sy_op_precedence(sy_op_peek()) == sy_op_precedence(*t1)) && sy_op_is_left_assoc(*t1))) { 913 while (cond_op_i && sy_op_peek() != '(' && ((sy_op_precedence(sy_op_peek()) > sy_op_precedence(*t1)) || (sy_op_precedence(sy_op_peek()) == sy_op_precedence(*t1) && sy_op_is_left_assoc(*t1)))) {
914 SY_APPLY_OP_FROM_STACK(); 914 SY_APPLY_OP_FROM_STACK();
915 }
916 sy_op_push(*t1);
917 goto yyc_cond;
918 } 915 }
916 sy_op_push(*t1);
917 goto yyc_cond;
918 }
919yy117: 919yy117:
920 yych = *++YYCURSOR; 920 yych = *++YYCURSOR;
921 if (yych == '=') goto yy119; 921 if (yych == '=') goto yy119;
diff --git a/src/sp_config_scanner.re b/src/sp_config_scanner.re
index f911df3..5fd1928 100644
--- a/src/sp_config_scanner.re
+++ b/src/sp_config_scanner.re
@@ -143,7 +143,7 @@ zend_result sp_config_scan(char *data, zend_result (*process_rule)(sp_parsed_key
143 zend_hash_str_add_ptr(&vars, ZEND_STRL("PHP_VERSION_ID"), zend_string_init(ZEND_STRL(ZEND_TOSTR(PHP_VERSION_ID)), 1)); 143 zend_hash_str_add_ptr(&vars, ZEND_STRL("PHP_VERSION_ID"), zend_string_init(ZEND_STRL(ZEND_TOSTR(PHP_VERSION_ID)), 1));
144 144
145 145
146 int cond_res[100] = {0}; 146 int cond_res[100] = {1};
147 int cond_res_i = 0; 147 int cond_res_i = 0;
148 char cond_op[100] = {0}; 148 char cond_op[100] = {0};
149 int cond_op_i = 0; 149 int cond_op_i = 0;
@@ -220,12 +220,12 @@ zend_result sp_config_scan(char *data, zend_result (*process_rule)(sp_parsed_key
220 case '>': op1 = 'G'; break; // >= 220 case '>': op1 = 'G'; break; // >=
221 } 221 }
222 } 222 }
223 while (cond_op_i && sy_op_peek() != '(' && ((sy_op_precedence(sy_op_peek()) > sy_op_precedence(*t1)) || (sy_op_precedence(sy_op_peek()) == sy_op_precedence(*t1)) && sy_op_is_left_assoc(*t1))) { 223 while (cond_op_i && sy_op_peek() != '(' && ((sy_op_precedence(sy_op_peek()) > sy_op_precedence(*t1)) || (sy_op_precedence(sy_op_peek()) == sy_op_precedence(*t1) && sy_op_is_left_assoc(*t1)))) {
224 SY_APPLY_OP_FROM_STACK(); 224 SY_APPLY_OP_FROM_STACK();
225 }
226 sy_op_push(*t1);
227 goto yyc_cond;
228 } 225 }
226 sy_op_push(*t1);
227 goto yyc_cond;
228 }
229 <cond_op> ")" { 229 <cond_op> ")" {
230 while (cond_op_i && sy_op_peek() != '(') { 230 while (cond_op_i && sy_op_peek() != '(') {
231 SY_APPLY_OP_FROM_STACK(); 231 SY_APPLY_OP_FROM_STACK();
@@ -233,7 +233,7 @@ zend_result sp_config_scan(char *data, zend_result (*process_rule)(sp_parsed_key
233 if (cond_op_i == 0 || sy_op_peek() != '(') { 233 if (cond_op_i == 0 || sy_op_peek() != '(') {
234 cs_error_log("unbalanced parathesis on line %d", lineno); goto out; 234 cs_error_log("unbalanced parathesis on line %d", lineno); goto out;
235 } 235 }
236 sy_op_pop(); 236 cond_op_i--;
237 goto yyc_cond_op; 237 goto yyc_cond_op;
238 } 238 }
239 <cond_op> ";" { 239 <cond_op> ";" {
diff --git a/src/tests/broken_configuration_php8/broken_conf_cookie_encryption_without_env_var.phpt b/src/tests/broken_configuration_php8/broken_conf_cookie_encryption_without_env_var.phpt
index 25371dd..99e391e 100644
--- a/src/tests/broken_configuration_php8/broken_conf_cookie_encryption_without_env_var.phpt
+++ b/src/tests/broken_configuration_php8/broken_conf_cookie_encryption_without_env_var.phpt
@@ -7,7 +7,7 @@ Broken configuration - encrypted cookie with without cookie env var
7sp.configuration_file={PWD}/config/broken_conf_cookie_encryption_without_env_var.ini 7sp.configuration_file={PWD}/config/broken_conf_cookie_encryption_without_env_var.ini
8--FILE-- 8--FILE--
9--EXPECT-- 9--EXPECT--
10Fatal error: [snuffleupagus][0.0.0.0][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in`sp.global`: please set it first in Unknown on line 0 10Fatal error: [snuffleupagus][0.0.0.0][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in `sp.global`: please set it first in Unknown on line 0
11 11
12Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0 12Fatal error: [snuffleupagus][0.0.0.0][config][log] Invalid configuration file in Unknown on line 0
13Could not startup. 13Could not startup.
diff --git a/src/tests/cookies_encryption_warning/encrypt_cookies_no_env.phpt b/src/tests/cookies_encryption_warning/encrypt_cookies_no_env.phpt
index a01c352..b31bf78 100644
--- a/src/tests/cookies_encryption_warning/encrypt_cookies_no_env.phpt
+++ b/src/tests/cookies_encryption_warning/encrypt_cookies_no_env.phpt
@@ -18,4 +18,4 @@ EOF;
18--EXPECT-- 18--EXPECT--
19Fatal error: [snuffleupagus][127.0.0.1][config][log] Invalid configuration file in Unknown on line 0 19Fatal error: [snuffleupagus][127.0.0.1][config][log] Invalid configuration file in Unknown on line 0
20 20
21Fatal error: [snuffleupagus][127.0.0.1][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in`sp.global`: please set it first in Unknown on line 0 21Fatal error: [snuffleupagus][127.0.0.1][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in `sp.global`: please set it first in Unknown on line 0
diff --git a/src/tests/cookies_encryption_warning/encrypt_regexp_cookies_no_env.phpt b/src/tests/cookies_encryption_warning/encrypt_regexp_cookies_no_env.phpt
index 1fe4074..d4b7e6a 100644
--- a/src/tests/cookies_encryption_warning/encrypt_regexp_cookies_no_env.phpt
+++ b/src/tests/cookies_encryption_warning/encrypt_regexp_cookies_no_env.phpt
@@ -18,4 +18,4 @@ EOF;
18--EXPECT-- 18--EXPECT--
19Fatal error: [snuffleupagus][127.0.0.1][config][log] Invalid configuration file in Unknown on line 0 19Fatal error: [snuffleupagus][127.0.0.1][config][log] Invalid configuration file in Unknown on line 0
20 20
21Fatal error: [snuffleupagus][127.0.0.1][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in`sp.global`: please set it first in Unknown on line 0 21Fatal error: [snuffleupagus][127.0.0.1][config][log] You're trying to use the cookie encryption feature on line 2 without having set the `.cookie_env_var` option in `sp.global`: please set it first in Unknown on line 0