diff options
Diffstat (limited to 'src/plugins/fuzzy_check.c')
-rw-r--r-- | src/plugins/fuzzy_check.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index d2b9d6601..54b27e650 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1065,93 +1065,6 @@ fuzzy_encrypt_cmd (struct fuzzy_rule *rule, } static struct fuzzy_cmd_io * -fuzzy_cmd_from_task_meta (struct fuzzy_rule *rule, - int c, - gint flag, - guint32 weight, - rspamd_mempool_t *pool, - struct rspamd_task *task) -{ - struct rspamd_fuzzy_cmd *cmd; - struct rspamd_fuzzy_encrypted_cmd *enccmd; - struct fuzzy_cmd_io *io; - rspamd_cryptobox_hash_state_t st; - - GHashTableIter it; - gpointer k, v; - struct rspamd_url *u; - struct raw_header *rh; - GList *cur; - - if (rule->peer_key) { - enccmd = rspamd_mempool_alloc0 (pool, sizeof (*enccmd)); - cmd = &enccmd->cmd; - } - else { - cmd = rspamd_mempool_alloc0 (pool, sizeof (*cmd)); - } - - cmd->cmd = c; - cmd->version = RSPAMD_FUZZY_PLUGIN_VERSION; - if (c != FUZZY_CHECK) { - cmd->flag = flag; - cmd->value = weight; - } - cmd->shingles_count = 0; - cmd->tag = ottery_rand_uint32 (); - /* Use blake2b for digest */ - rspamd_cryptobox_hash_init (&st, rule->hash_key->str, rule->hash_key->len); - /* Hash URL's */ - g_hash_table_iter_init (&it, task->urls); - - while (g_hash_table_iter_next (&it, &k, &v)) { - u = v; - if (u->hostlen > 0) { - rspamd_cryptobox_hash_update (&st, u->host, u->hostlen); - } - if (u->datalen > 0) { - rspamd_cryptobox_hash_update (&st, u->data, u->datalen); - } - } - /* Now get some headers to iterate on */ - - cur = rule->fuzzy_headers; - - while (cur) { - rh = g_hash_table_lookup (task->raw_headers, cur->data); - - while (rh) { - if (rh->decoded) { - rspamd_cryptobox_hash_update (&st, rh->decoded, - strlen (rh->decoded)); - } - - rh = rh->next; - } - cur = g_list_next (cur); - } - - rspamd_cryptobox_hash_final (&st, cmd->digest); - - io = rspamd_mempool_alloc (pool, sizeof (*io)); - io->flags = 0; - io->tag = cmd->tag; - memcpy (&io->cmd, cmd, sizeof (io->cmd)); - - if (rule->peer_key) { - fuzzy_encrypt_cmd (rule, &enccmd->hdr, (guchar *)cmd, sizeof (*cmd)); - io->io.iov_base = enccmd; - io->io.iov_len = sizeof (*enccmd); - } - else { - io->io.iov_base = cmd; - io->io.iov_len = sizeof (*cmd); - } - - return io; -} - -static struct fuzzy_cmd_io * fuzzy_cmd_stat (struct fuzzy_rule *rule, int c, gint flag, |