From aa5d6895d0ac8c6ea050a8ea55e2f8a39ddfe365 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Tue, 28 Aug 2018 14:24:29 +0200 Subject: Use php's logging functions This commit replace our usage of `php_log_err` with `zend_error`. This should allow administrators to display errors in the webpage, should they want to; and to properly manipulate the verbosity's level. This should close #217 --- src/sp_crypt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sp_crypt.c') diff --git a/src/sp_crypt.c b/src/sp_crypt.c index d3588b4..f4d1799 100644 --- a/src/sp_crypt.c +++ b/src/sp_crypt.c @@ -27,10 +27,10 @@ void generate_key(unsigned char *key) { if (env_var) { PHP_SHA256Update(&ctx, (unsigned char *)env_var, strlen(env_var)); } else { - sp_log_err( + sp_log_warn( "cookie_encryption", - "The environment variable '%s'" - "is empty, cookies are weakly encrypted.", + "The environment variable '%s' " + "is empty, cookies are weakly encrypted", ZSTR_VAL( SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)); } @@ -58,13 +58,13 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { sp_log_msg( "cookie_encryption", SP_LOG_SIMULATION, "Buffer underflow tentative detected in cookie encryption handling " - "for %s. Using the cookie 'as it' instead of decrypting it.", + "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, - "Buffer underflow tentative detected in cookie encryption handling."); + "Buffer underflow tentative detected in cookie encryption handling"); return ZEND_HASH_APPLY_REMOVE; } } @@ -106,7 +106,7 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { return ZEND_HASH_APPLY_KEEP; } else { sp_log_msg("cookie_encryption", SP_LOG_DROP, - "Something went wrong with the decryption of %s.", + "Something went wrong with the decryption of %s", hash_key ? ZSTR_VAL(hash_key->key) : "the session"); return ZEND_HASH_APPLY_REMOVE; } -- cgit v1.3