From: Vsevolod Stakhov Date: Tue, 6 Oct 2015 15:38:48 +0000 (+0100) Subject: Fix plugins. X-Git-Tag: 1.0.5~67^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=748225b8e91105b4da3df8aa00c0b2e116a30df8;p=rspamd.git Fix plugins. --- diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 6de4ef904..d92ceb1ad 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -215,12 +215,12 @@ rspamd_str_equal (gconstpointer v, gconstpointer v2) } gboolean -rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2) +rspamd_ftok_icase_equal (gconstpointer v, gconstpointer v2) { - const rspamd_fstring_t *f1 = v, *f2 = v2; + const rspamd_ftok_t *f1 = v, *f2 = v2; if (f1->len == f2->len && - g_ascii_strncasecmp (f1->str, f2->str, f1->len) == 0) { + g_ascii_strncasecmp (f1->begin, f2->begin, f1->len) == 0) { return TRUE; } @@ -229,11 +229,11 @@ rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2) guint -rspamd_fstring_icase_hash (gconstpointer key) +rspamd_ftok_icase_hash (gconstpointer key) { - const rspamd_fstring_t *f = key; + const rspamd_ftok_t *f = key; - return rspamd_icase_hash (f->str, f->len); + return rspamd_icase_hash (f->begin, f->len); } gboolean diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index b6c8b2981..fdadc4811 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -53,8 +53,8 @@ gboolean rspamd_str_equal (gconstpointer v, gconstpointer v2); /* * Hash table utility functions for hashing fixed strings */ -guint rspamd_fstring_icase_hash (gconstpointer key); -gboolean rspamd_fstring_icase_equal (gconstpointer v, gconstpointer v2); +guint rspamd_ftok_icase_hash (gconstpointer key); +gboolean rspamd_ftok_icase_equal (gconstpointer v, gconstpointer v2); guint rspamd_gstring_icase_hash (gconstpointer key); gboolean rspamd_gstring_icase_equal (gconstpointer v, gconstpointer v2); diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 8b5c2ee58..bc4822b17 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -621,7 +621,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, struct rspamd_shingle *sh; guint i; blake2b_state st; - rspamd_fstring_t *word; + rspamd_ftok_t *word; GArray *words; struct fuzzy_cmd_io *io; struct rspamd_http_keypair *lk, *rk; @@ -645,7 +645,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, words = fuzzy_preprocess_words (part, pool); for (i = 0; i < words->len; i ++) { - word = &g_array_index (words, rspamd_fstring_t, i); + word = &g_array_index (words, rspamd_ftok_t, i); blake2b_update (&st, word->begin, word->len); } blake2b_final (&st, shcmd->basic.digest, sizeof (shcmd->basic.digest)); @@ -1466,7 +1466,7 @@ fuzzy_process_handler (struct rspamd_http_connection_entry *conn_ent, /* Allocate message from string */ /* XXX: what about encrypted messsages ? */ - task->msg.start = msg->body->str; + task->msg.begin = msg->body->str; task->msg.len = msg->body->len; saved = rspamd_mempool_alloc0 (task->task_pool, sizeof (gint)); diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 882eed2d4..37c0857d6 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -91,8 +91,7 @@ exception_insert (gpointer st, gconstpointer key, gpointer value) GHashTable **t = st; gint level = 0; const gchar *p = key; - rspamd_fstring_t *val; - + rspamd_ftok_t *val; while (*p) { if (*p == '.') { @@ -107,12 +106,12 @@ exception_insert (gpointer st, gconstpointer key, gpointer value) return; } - val = g_malloc (sizeof (rspamd_fstring_t)); - val->begin = (gchar *)key; + val = g_malloc (sizeof (rspamd_ftok_t)); + val->begin = key; val->len = strlen (key); if (t[level] == NULL) { - t[level] = g_hash_table_new_full (rspamd_fstring_icase_hash, - rspamd_fstring_icase_equal, + t[level] = g_hash_table_new_full (rspamd_ftok_icase_hash, + rspamd_ftok_icase_equal, g_free, NULL); } @@ -654,7 +653,7 @@ surbl_module_reconfig (struct rspamd_config *cfg) static gchar * format_surbl_request (rspamd_mempool_t * pool, - rspamd_fstring_t * hostname, + rspamd_ftok_t * hostname, struct suffix_item *suffix, gboolean append_suffix, GError ** err, @@ -663,12 +662,12 @@ format_surbl_request (rspamd_mempool_t * pool, struct rspamd_url *url) { GHashTable *t; - gchar *result = NULL, *dots[MAX_LEVELS], - num_buf[sizeof("18446744073709551616")], *p; + gchar *result = NULL, num_buf[sizeof("18446744073709551616")]; + const gchar *p, *dots[MAX_LEVELS]; gint len, slen, r, i, dots_num = 0, level = MAX_LEVELS; gboolean is_numeric = TRUE, found_exception = FALSE; guint64 ip_num; - rspamd_fstring_t f; + rspamd_ftok_t f; if (G_LIKELY (suffix != NULL)) { slen = strlen (suffix->suffix); @@ -852,7 +851,7 @@ make_surbl_requests (struct rspamd_url *url, struct rspamd_task *task, struct suffix_item *suffix, gboolean forced, GHashTable *tree) { gchar *surbl_req; - rspamd_fstring_t f; + rspamd_ftok_t f; GError *err = NULL; struct dns_param *param;