diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-12 11:38:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-12 11:38:35 +0100 |
commit | 63f496b42a2d80f4a7609e666d21a70e5d44a60f (patch) | |
tree | 785286abe30404529cdd7203b392e9a60c71e901 /src/controller.c | |
parent | a8ec6f2ee7b2d5d87f802d1e42f2fd107a3cb79d (diff) | |
download | rspamd-63f496b42a2d80f4a7609e666d21a70e5d44a60f.tar.gz rspamd-63f496b42a2d80f4a7609e666d21a70e5d44a60f.zip |
[Fix] Fix logic of cached passwords check
Issue: #913
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/controller.c b/src/controller.c index 37364813d..f1daba22c 100644 --- a/src/controller.c +++ b/src/controller.c @@ -291,13 +291,34 @@ rspamd_check_encrypted_password (struct rspamd_controller_worker_ctx *ctx, if (password->len != ctx->cached_password.len || !rspamd_constant_memcmp (password->begin, ctx->cached_password.begin, password->len)) { - msg_info_ctx ("incorrect or absent password has been specified"); - return FALSE; + /* We still need to check enable password here */ + if (ctx->cached_enable_password.len != 0) { + if (password->len != ctx->cached_enable_password.len || + !rspamd_constant_memcmp (password->begin, + ctx->cached_enable_password.begin, + password->len)) { + msg_info_ctx ( + "incorrect or absent password has been specified"); + + return FALSE; + } + else { + /* Cached matched */ + return TRUE; + } + } + else { + /* We might want to check uncached version */ + goto check_uncached; + } + } + else { + /* Cached matched */ + return TRUE; } - - return TRUE; } +check_uncached: g_assert (pbkdf != NULL); /* get salt */ salt = rspamd_encrypted_password_get_str (check, 3, &salt_len); |