diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-18 22:07:28 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-18 22:07:28 +0400 |
commit | 9759175c6dcb897101db3528dc4f36e8c20639c1 (patch) | |
tree | 0452c2167c33c71990fc2713925d395e14651635 /src/util.c | |
parent | e4eb49311b06fc0f820fb64d800d15a295d190a6 (diff) | |
download | rspamd-9759175c6dcb897101db3528dc4f36e8c20639c1.tar.gz rspamd-9759175c6dcb897101db3528dc4f36e8c20639c1.zip |
* New logic of SURBL module:
- remove completely 2tld
- add option "exception"
- for domains from exception list check (level + 1) parts of url:
If we have url mail.some.com.ru and have com.ru in exception list
then we would check some.com.ru. If we have some.com.ru in exceptions
list them mail.some.com.ru would be checked and so on.
- optimized parsing of surbl requests
* Use system mkstemp(3) on systems where it is available as glib implementation
has poor security and generate rather predictable temporary file names.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index bf0a491f3..9ab0820f0 100644 --- a/src/util.c +++ b/src/util.c @@ -855,6 +855,34 @@ rspamd_strcase_hash (gconstpointer key) return h; } +gboolean +fstr_strcase_equal (gconstpointer v, gconstpointer v2) +{ + const f_str_t *f1 = v, *f2 = v2; + if (f1->len == f2->len && g_ascii_strncasecmp (f1->begin, f2->begin, f1->len) == 0) { + return TRUE; + } + + return FALSE; +} + + +guint +fstr_strcase_hash (gconstpointer key) +{ + const f_str_t *f = key; + const char *p; + guint h = 0; + + p = f->begin; + while (p - f->begin < f->len) { + h = (h << 5) - h + g_tolower (*p); + p++; + } + + return h; +} + void gperf_profiler_init (struct config_file *cfg, const char *descr) { |