diff options
| author | Giovanni | 2020-07-22 09:28:42 +0200 |
|---|---|---|
| committer | GitHub | 2020-07-22 09:28:42 +0200 |
| commit | e8d3cd9b26f0b4d660e424f2657f11bbc01eb171 (patch) | |
| tree | fa2b312815be8b50afae7fd0447fe891ab19a487 /src/sp_crypt.c | |
| parent | 5a655dda1c3b666adf552fd50f5ebf5f4cbd3ce7 (diff) | |
refactoring sp_log_* (#340)
Co-authored-by: Giovanni Dante Grazioli <giovanni.dantegrazioli@nbs-system.com>
Diffstat (limited to 'src/sp_crypt.c')
| -rw-r--r-- | src/sp_crypt.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/sp_crypt.c b/src/sp_crypt.c index 42c1510..b353ebe 100644 --- a/src/sp_crypt.c +++ b/src/sp_crypt.c | |||
| @@ -49,16 +49,16 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 49 | 49 | ||
| 50 | if (ZSTR_LEN(debase64) < crypto_secretbox_NONCEBYTES) { | 50 | if (ZSTR_LEN(debase64) < crypto_secretbox_NONCEBYTES) { |
| 51 | if (true == simulation) { | 51 | if (true == simulation) { |
| 52 | sp_log_msg( | 52 | sp_log_simulation( |
| 53 | "cookie_encryption", SP_LOG_SIMULATION, | 53 | "cookie_encryption", |
| 54 | "Buffer underflow tentative detected in cookie encryption handling " | 54 | "Buffer underflow tentative detected in cookie encryption handling " |
| 55 | "for %s. Using the cookie 'as it' instead of decrypting it", | 55 | "for %s. Using the cookie 'as it' instead of decrypting it", |
| 56 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 56 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| 57 | return ZEND_HASH_APPLY_KEEP; | 57 | return ZEND_HASH_APPLY_KEEP; |
| 58 | } else { | 58 | } else { |
| 59 | // LCOV_EXCL_START | 59 | // LCOV_EXCL_START |
| 60 | sp_log_msg( | 60 | sp_log_drop( |
| 61 | "cookie_encryption", SP_LOG_DROP, | 61 | "cookie_encryption", |
| 62 | "Buffer underflow tentative detected in cookie encryption handling"); | 62 | "Buffer underflow tentative detected in cookie encryption handling"); |
| 63 | return ZEND_HASH_APPLY_REMOVE; | 63 | return ZEND_HASH_APPLY_REMOVE; |
| 64 | // LCOV_EXCL_STOP | 64 | // LCOV_EXCL_STOP |
| @@ -69,15 +69,15 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 69 | if (ZSTR_LEN(debase64) + (size_t)crypto_secretbox_ZEROBYTES < | 69 | if (ZSTR_LEN(debase64) + (size_t)crypto_secretbox_ZEROBYTES < |
| 70 | ZSTR_LEN(debase64)) { | 70 | ZSTR_LEN(debase64)) { |
| 71 | if (true == simulation) { | 71 | if (true == simulation) { |
| 72 | sp_log_msg( | 72 | sp_log_simulation( |
| 73 | "cookie_encryption", SP_LOG_SIMULATION, | 73 | "cookie_encryption", |
| 74 | "Integer overflow tentative detected in cookie encryption handling " | 74 | "Integer overflow tentative detected in cookie encryption handling " |
| 75 | "for %s. Using the cookie 'as it' instead of decrypting it.", | 75 | "for %s. Using the cookie 'as it' instead of decrypting it.", |
| 76 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 76 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| 77 | return ZEND_HASH_APPLY_KEEP; | 77 | return ZEND_HASH_APPLY_KEEP; |
| 78 | } else { | 78 | } else { |
| 79 | sp_log_msg( | 79 | sp_log_drop( |
| 80 | "cookie_encryption", SP_LOG_DROP, | 80 | "cookie_encryption", |
| 81 | "Integer overflow tentative detected in cookie encryption handling."); | 81 | "Integer overflow tentative detected in cookie encryption handling."); |
| 82 | return ZEND_HASH_APPLY_REMOVE; | 82 | return ZEND_HASH_APPLY_REMOVE; |
| 83 | } | 83 | } |
| @@ -98,8 +98,8 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 98 | 98 | ||
| 99 | if (-1 == ret) { | 99 | if (-1 == ret) { |
| 100 | if (true == simulation) { | 100 | if (true == simulation) { |
| 101 | sp_log_msg( | 101 | sp_log_simulation( |
| 102 | "cookie_encryption", SP_LOG_SIMULATION, | 102 | "cookie_encryption", |
| 103 | "Something went wrong with the decryption of %s. Using the cookie " | 103 | "Something went wrong with the decryption of %s. Using the cookie " |
| 104 | "'as it' instead of decrypting it", | 104 | "'as it' instead of decrypting it", |
| 105 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 105 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| @@ -107,7 +107,7 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 107 | efree(backup); | 107 | efree(backup); |
| 108 | return ZEND_HASH_APPLY_KEEP; | 108 | return ZEND_HASH_APPLY_KEEP; |
| 109 | } else { | 109 | } else { |
| 110 | sp_log_msg("cookie_encryption", SP_LOG_WARN, | 110 | sp_log_warn("cookie_encryption", |
| 111 | "Something went wrong with the decryption of %s", | 111 | "Something went wrong with the decryption of %s", |
| 112 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 112 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| 113 | efree(backup); | 113 | efree(backup); |
