From e8d3cd9b26f0b4d660e424f2657f11bbc01eb171 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Wed, 22 Jul 2020 09:28:42 +0200 Subject: refactoring sp_log_* (#340) Co-authored-by: Giovanni Dante Grazioli --- src/sp_crypt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/sp_crypt.c') 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) { if (ZSTR_LEN(debase64) < crypto_secretbox_NONCEBYTES) { if (true == simulation) { - sp_log_msg( - "cookie_encryption", SP_LOG_SIMULATION, + sp_log_simulation( + "cookie_encryption", "Buffer underflow tentative detected in cookie encryption handling " "for %s. Using the cookie 'as it' instead of decrypting it", hash_key ? ZSTR_VAL(hash_key->key) : "the session"); return ZEND_HASH_APPLY_KEEP; } else { // LCOV_EXCL_START - sp_log_msg( - "cookie_encryption", SP_LOG_DROP, + sp_log_drop( + "cookie_encryption", "Buffer underflow tentative detected in cookie encryption handling"); return ZEND_HASH_APPLY_REMOVE; // LCOV_EXCL_STOP @@ -69,15 +69,15 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { if (ZSTR_LEN(debase64) + (size_t)crypto_secretbox_ZEROBYTES < ZSTR_LEN(debase64)) { if (true == simulation) { - sp_log_msg( - "cookie_encryption", SP_LOG_SIMULATION, + sp_log_simulation( + "cookie_encryption", "Integer overflow tentative detected in cookie encryption handling " "for %s. Using the cookie 'as it' instead of decrypting it.", hash_key ? ZSTR_VAL(hash_key->key) : "the session"); return ZEND_HASH_APPLY_KEEP; } else { - sp_log_msg( - "cookie_encryption", SP_LOG_DROP, + sp_log_drop( + "cookie_encryption", "Integer overflow tentative detected in cookie encryption handling."); return ZEND_HASH_APPLY_REMOVE; } @@ -98,8 +98,8 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { if (-1 == ret) { if (true == simulation) { - sp_log_msg( - "cookie_encryption", SP_LOG_SIMULATION, + sp_log_simulation( + "cookie_encryption", "Something went wrong with the decryption of %s. Using the cookie " "'as it' instead of decrypting it", 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) { efree(backup); return ZEND_HASH_APPLY_KEEP; } else { - sp_log_msg("cookie_encryption", SP_LOG_WARN, + sp_log_warn("cookie_encryption", "Something went wrong with the decryption of %s", hash_key ? ZSTR_VAL(hash_key->key) : "the session"); efree(backup); -- cgit v1.3