From: Vsevolod Stakhov Date: Sun, 5 Oct 2025 15:36:23 +0000 (+0100) Subject: [Fix] Update HTML fuzzy encryption to use helper functions X-Git-Tag: 3.14.0~87^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=780b08ee78b774920546ad4912529a547129dd87;p=thirdparty%2Frspamd.git [Fix] Update HTML fuzzy encryption to use helper functions The fuzzy_cmd_from_html_part() function was using legacy encryption logic that only checked rule->peer_key. Updated to use fuzzy_rule_has_encryption() and fuzzy_select_encryption_keys() helpers for consistency with other fuzzy command functions and to support separate read/write encryption keys. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 4d24f71821..395fc2512a 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2383,10 +2383,15 @@ fuzzy_cmd_from_html_part(struct rspamd_task *task, io->flags = FUZZY_CMD_FLAG_HTML; memcpy(&io->cmd, &shcmd->basic, sizeof(io->cmd)); - if (rule->peer_key) { + if (fuzzy_rule_has_encryption(rule)) { + struct rspamd_cryptobox_keypair *local_key; + struct rspamd_cryptobox_pubkey *peer_key; + + fuzzy_select_encryption_keys(rule, c, &local_key, &peer_key); + /* Encrypt data */ fuzzy_encrypt_cmd(rule, &encshcmd->hdr, (unsigned char *) shcmd, - sizeof(*shcmd) + additional_length); + sizeof(*shcmd) + additional_length, local_key, peer_key); io->io.iov_base = encshcmd; io->io.iov_len = sizeof(*encshcmd) + additional_length; }