diff options
| author | xXx-caillou-xXx | 2018-08-28 14:24:29 +0200 |
|---|---|---|
| committer | jvoisin | 2018-08-28 12:24:29 +0000 |
| commit | aa5d6895d0ac8c6ea050a8ea55e2f8a39ddfe365 (patch) | |
| tree | c640e50ab007bae3a2fd55ca05bc13c73e293c69 /src/sp_crypt.c | |
| parent | eff2c658d37108020215f838d4c47c176ec3e050 (diff) | |
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
Diffstat (limited to 'src/sp_crypt.c')
| -rw-r--r-- | src/sp_crypt.c | 12 |
1 files changed, 6 insertions, 6 deletions
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) { | |||
| 27 | if (env_var) { | 27 | if (env_var) { |
| 28 | PHP_SHA256Update(&ctx, (unsigned char *)env_var, strlen(env_var)); | 28 | PHP_SHA256Update(&ctx, (unsigned char *)env_var, strlen(env_var)); |
| 29 | } else { | 29 | } else { |
| 30 | sp_log_err( | 30 | sp_log_warn( |
| 31 | "cookie_encryption", | 31 | "cookie_encryption", |
| 32 | "The environment variable '%s'" | 32 | "The environment variable '%s' " |
| 33 | "is empty, cookies are weakly encrypted.", | 33 | "is empty, cookies are weakly encrypted", |
| 34 | ZSTR_VAL( | 34 | ZSTR_VAL( |
| 35 | SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)); | 35 | SNUFFLEUPAGUS_G(config).config_snuffleupagus->cookies_env_var)); |
| 36 | } | 36 | } |
| @@ -58,13 +58,13 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 58 | sp_log_msg( | 58 | sp_log_msg( |
| 59 | "cookie_encryption", SP_LOG_SIMULATION, | 59 | "cookie_encryption", SP_LOG_SIMULATION, |
| 60 | "Buffer underflow tentative detected in cookie encryption handling " | 60 | "Buffer underflow tentative detected in cookie encryption handling " |
| 61 | "for %s. Using the cookie 'as it' instead of decrypting it.", | 61 | "for %s. Using the cookie 'as it' instead of decrypting it", |
| 62 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 62 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| 63 | return ZEND_HASH_APPLY_KEEP; | 63 | return ZEND_HASH_APPLY_KEEP; |
| 64 | } else { | 64 | } else { |
| 65 | sp_log_msg( | 65 | sp_log_msg( |
| 66 | "cookie_encryption", SP_LOG_DROP, | 66 | "cookie_encryption", SP_LOG_DROP, |
| 67 | "Buffer underflow tentative detected in cookie encryption handling."); | 67 | "Buffer underflow tentative detected in cookie encryption handling"); |
| 68 | return ZEND_HASH_APPLY_REMOVE; | 68 | return ZEND_HASH_APPLY_REMOVE; |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| @@ -106,7 +106,7 @@ int decrypt_zval(zval *pDest, bool simulation, zend_hash_key *hash_key) { | |||
| 106 | return ZEND_HASH_APPLY_KEEP; | 106 | return ZEND_HASH_APPLY_KEEP; |
| 107 | } else { | 107 | } else { |
| 108 | sp_log_msg("cookie_encryption", SP_LOG_DROP, | 108 | sp_log_msg("cookie_encryption", SP_LOG_DROP, |
| 109 | "Something went wrong with the decryption of %s.", | 109 | "Something went wrong with the decryption of %s", |
| 110 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); | 110 | hash_key ? ZSTR_VAL(hash_key->key) : "the session"); |
| 111 | return ZEND_HASH_APPLY_REMOVE; | 111 | return ZEND_HASH_APPLY_REMOVE; |
| 112 | } | 112 | } |
