aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-21 14:54:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-21 15:09:39 +0100
commit00a656be5aca1da4eaf46760b4ec26fe90a0cd0a (patch)
tree4835343a8c17a0d427166ba8fe2985f411825324 /src/libserver
parent00d264e7be01c9a479d2504e61e5628c977a2838 (diff)
downloadrspamd-00a656be5aca1da4eaf46760b4ec26fe90a0cd0a.tar.gz
rspamd-00a656be5aca1da4eaf46760b4ec26fe90a0cd0a.zip
[Fix] Use watchers for spf plugin
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/spf.c7
-rw-r--r--src/libserver/spf.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/src/libserver/spf.c b/src/libserver/spf.c
index 7fae50523..aa777f85c 100644
--- a/src/libserver/spf.c
+++ b/src/libserver/spf.c
@@ -60,6 +60,7 @@ struct spf_record {
gchar *local_part;
struct rspamd_task *task;
spf_cb_t callback;
+ gpointer cbdata;
gboolean done;
};
@@ -356,7 +357,7 @@ rspamd_spf_maybe_return (struct spf_record *rec)
if (rec->requests_inflight == 0 && !rec->done) {
flat = rspamd_spf_record_flatten (rec);
- rec->callback (flat, rec->task);
+ rec->callback (flat, rec->task, rec->cbdata);
REF_RELEASE (flat);
rec->done = TRUE;
}
@@ -1821,7 +1822,8 @@ rspamd_spf_get_domain (struct rspamd_task *task)
}
gboolean
-resolve_spf (struct rspamd_task *task, spf_cb_t callback)
+rspamd_spf_resolve (struct rspamd_task *task, spf_cb_t callback,
+ gpointer cbdata)
{
struct spf_record *rec;
struct rspamd_spf_cred *cred;
@@ -1839,6 +1841,7 @@ resolve_spf (struct rspamd_task *task, spf_cb_t callback)
rec = rspamd_mempool_alloc0 (task->task_pool, sizeof (struct spf_record));
rec->task = task;
rec->callback = callback;
+ rec->cbdata = cbdata;
rec->resolved = g_ptr_array_sized_new (8);
diff --git a/src/libserver/spf.h b/src/libserver/spf.h
index 01850a392..001d3775a 100644
--- a/src/libserver/spf.h
+++ b/src/libserver/spf.h
@@ -8,7 +8,8 @@
struct rspamd_task;
struct spf_resolved;
-typedef void (*spf_cb_t)(struct spf_resolved *record, struct rspamd_task *task);
+typedef void (*spf_cb_t)(struct spf_resolved *record,
+ struct rspamd_task *task, gpointer cbdata);
typedef enum spf_mech_e {
SPF_FAIL,
@@ -66,7 +67,8 @@ struct spf_resolved {
/*
* Resolve spf record for specified task and call a callback after resolution fails/succeed
*/
-gboolean resolve_spf (struct rspamd_task *task, spf_cb_t callback);
+gboolean rspamd_spf_resolve (struct rspamd_task *task, spf_cb_t callback,
+ gpointer cbdata);
/*
* Get a domain for spf for specified task