From: Vsevolod Stakhov Date: Tue, 20 Feb 2024 16:07:48 +0000 (+0000) Subject: [Minor] Allow to have only dynamic keys in fuzzy storage X-Git-Tag: 3.8.2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6c8e9a33783efe1a066a1ca9a4db6a54cad5101d;p=rspamd.git [Minor] Allow to have only dynamic keys in fuzzy storage --- diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index efa53b15b..b4d2b802b 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -1628,7 +1628,7 @@ rspamd_fuzzy_decrypt_command(struct fuzzy_session *s, guchar *buf, gsize buflen) struct rspamd_cryptobox_pubkey *rk; struct fuzzy_key *key = NULL; - if (s->ctx->default_key == NULL) { + if (s->ctx->default_key == NULL && s->ctx->dynamic_keys == NULL) { msg_warn("received encrypted request when encryption is not enabled"); return FALSE; } @@ -1661,6 +1661,12 @@ rspamd_fuzzy_decrypt_command(struct fuzzy_session *s, guchar *buf, gsize buflen) key = kh_val(s->ctx->keys, k); } + if (key == NULL) { + /* Cannot find any suitable decryption key */ + msg_debug("cannot find suitable decryption key"); + return FALSE; + } + /* Now process the remote pubkey */ rk = rspamd_pubkey_from_bin(hdr.pubkey, sizeof(hdr.pubkey), RSPAMD_KEYPAIR_KEX, RSPAMD_CRYPTOBOX_MODE_25519);