blob: 616595c356ffcaca4dce4b8bb004c9ae5ebb5164 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef RSPAMD_SPF_H
#define RSPAMD_SPF_H
#include "config.h"
struct rspamd_task;
struct spf_record;
typedef void (*spf_cb_t)(struct spf_record *record, struct rspamd_task *task);
typedef enum spf_mech_e {
SPF_FAIL,
SPF_SOFT_FAIL,
SPF_PASS,
SPF_NEUTRAL
} spf_mech_t;
typedef enum spf_action_e {
SPF_RESOLVE_MX,
SPF_RESOLVE_A,
SPF_RESOLVE_PTR,
SPF_RESOLVE_AAA,
SPF_RESOLVE_REDIRECT,
SPF_RESOLVE_INCLUDE,
SPF_RESOLVE_EXISTS,
SPF_RESOLVE_EXP
} spf_action_t;
struct spf_addr {
union {
struct {
union {
struct in_addr in4;
#ifdef HAVE_INET_PTON
struct in6_addr in6;
#endif
} d;
guint32 mask;
gboolean ipv6;
gboolean parsed;
gboolean addr_any;
} normal;
GList *list;
} data;
gboolean is_list;
spf_mech_t mech;
gchar *spf_string;
};
struct spf_record {
gchar **elts;
gchar *cur_elt;
gint elt_num;
gint nested;
gint dns_requests;
gint requests_inflight;
guint ttl;
GList *addrs;
gchar *cur_domain;
const gchar *sender;
gchar *sender_domain;
gchar *local_part;
struct rspamd_task *task;
spf_cb_t callback;
gboolean in_include;
};
/*
* 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);
/*
* Get a domain for spf for specified task
*/
gchar * get_spf_domain (struct rspamd_task *task);
#endif
|