diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-20 10:00:24 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-20 10:00:24 +0000 |
commit | 387a965d59819dffcac434bc0049fa4fe63dfaa3 (patch) | |
tree | a6c4e3938bc7bd6c084803eec5a339a3e10f401e /src/libstat/learn_cache/sqlite3_cache.c | |
parent | 319d3bfc5cfdfef95f3268d128655a88d3fda13d (diff) | |
download | rspamd-387a965d59819dffcac434bc0049fa4fe63dfaa3.tar.gz rspamd-387a965d59819dffcac434bc0049fa4fe63dfaa3.zip |
Fix hash calculation for sqlite stats
Diffstat (limited to 'src/libstat/learn_cache/sqlite3_cache.c')
-rw-r--r-- | src/libstat/learn_cache/sqlite3_cache.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index 77a2cafef..7c5174fcf 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -183,9 +183,8 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, gpointer runtime) { struct rspamd_stat_sqlite3_ctx *ctx = runtime; - struct mime_text_part *part; rspamd_cryptobox_hash_state_t st; - rspamd_ftok_t *word; + rspamd_token_t *tok; guchar *out; gchar *user = NULL; guint i, j; @@ -203,15 +202,9 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, rspamd_cryptobox_hash_update (&st, user, strlen (user)); } - for (i = 0; i < task->text_parts->len; i ++) { - part = g_ptr_array_index (task->text_parts, i); - - if (part->normalized_words != NULL) { - for (j = 0; j < part->normalized_words->len; j ++) { - word = &g_array_index (part->normalized_words, rspamd_ftok_t, j); - rspamd_cryptobox_hash_update (&st, word->begin, word->len); - } - } + for (i = 0; i < task->tokens->len; i ++) { + tok = g_ptr_array_index (task->tokens, i); + rspamd_cryptobox_hash_update (&st, tok->data, tok->datalen); } rspamd_cryptobox_hash_final (&st, out); |