]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to have only dynamic keys in fuzzy storage
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 20 Feb 2024 16:07:48 +0000 (16:07 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 20 Feb 2024 16:07:48 +0000 (16:07 +0000)
src/fuzzy_storage.c

index efa53b15b84200712cae0d28e87471cae9e441c1..b4d2b802b7349ad029cea9c63e3303a0a9a5903b 100644 (file)
@@ -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);