Mercurial > dnsbl
annotate src/context.h @ 435:afd10321eb70
Added tag stable-6-0-63 for changeset a83ed5615403
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 24 Oct 2017 09:17:10 -0700 |
parents | 6f2db3d19a34 |
children | 7b072e16bd69 |
rev | line source |
---|---|
143 | 1 /* |
2 | |
152 | 3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under |
4 the GPL version 3 or any later version at your choice available at | |
5 http://www.gnu.org/licenses/gpl-3.0.txt | |
143 | 6 |
7 */ | |
8 | |
94 | 9 #ifndef context_include |
10 #define context_include | |
11 | |
428
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
12 #ifdef NS_PACKETSZ |
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
13 #define maxdnslength (NS_PACKETSZ*8) |
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
14 #else |
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
15 #define maxdnslength 1000 |
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
16 #endif |
6f2db3d19a34
allow 4000 byte spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
423
diff
changeset
|
17 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
18 enum status {oksofar, // not rejected yet |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
19 white, // whitelisted |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
20 black, // blacklisted |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
21 reject}; // rejected by a dns list |
94 | 22 |
321
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
23 class DKIM; |
94 | 24 class DNSBL; |
249 | 25 class DNSWL; |
94 | 26 class CONTEXT; |
27 class VERIFY; | |
28 class SMTP; | |
153 | 29 class WHITELISTER; |
192
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
30 class DELAYWHITE; |
94 | 31 class recorder; |
381
879a470c6ac3
fetch spf txt records for required dkim signers
Carl Byington <carl@five-ten-sg.com>
parents:
360
diff
changeset
|
32 class mlfiPriv; |
94 | 33 |
382
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
34 typedef map<const char *, const char *, ltstr> string_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
35 typedef set<int> int_set; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
36 typedef set<int32_t> int32_t_set; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
37 typedef int32_t_set * int32_t_set_p; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
38 typedef set<uint32_t> uint32_t_set; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
39 typedef uint32_t_set * uint32_t_set_p; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
40 typedef list<SMTP *> smtp_list; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
41 typedef DKIM * DKIMP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
42 typedef DNSBL * DNSBLP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
43 typedef DNSWL * DNSWLP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
44 typedef VERIFY * VERIFYP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
45 typedef WHITELISTER * WHITELISTERP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
46 typedef DELAYWHITE * DELAYWHITEP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
47 typedef map<const char *, DKIMP, ltstr> dkimp_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
48 typedef list<DNSBLP> dnsblp_list; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
49 typedef map<const char *, DNSBLP, ltstr> dnsblp_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
50 typedef list<DNSWLP> dnswlp_list; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
51 typedef map<const char *, DNSWLP, ltstr> dnswlp_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
52 typedef CONTEXT * CONTEXTP; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
53 typedef list<CONTEXTP> context_list; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
54 typedef map<const char *, CONTEXTP, ltstr> context_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
55 typedef map<const char *, uint32_t, ltstr> ns_mapper; // name to ipv4 address |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
56 typedef map<const char *, int, ltstr> rates; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
57 typedef map<const char *, uint32_t_set_p, ltstr> auth_addresses; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
58 typedef map<const char *, time_t, ltstr> autowhite_sent; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
59 typedef map<const char *, VERIFYP, ltstr> verify_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
60 typedef map<const char *, WHITELISTERP, ltstr> whitelister_map; |
c378e9d03f37
start parsing spf txt records
Carl Byington <carl@five-ten-sg.com>
parents:
381
diff
changeset
|
61 typedef list<DELAYWHITEP> delay_whitelist; |
94 | 62 |
63 class SMTP { | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
64 static const int maxlen = 1000; |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
65 static const int qlen = 20; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
66 int fd; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
67 bool error; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
68 time_t stamp; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
69 char efrom[maxlen]; // last envelope from sent on this socket |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
70 int pending; // unread bytes in buffer, not including the null terminator |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
71 char buffer[maxlen]; |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
72 char queueid[qlen]; // last queueid for logging |
94 | 73 public: |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
74 SMTP(int f) {fd = f; error = false; now(); efrom[0] = '\0'; queueid[0] = '\0'; init();}; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
75 ~SMTP() {if (!error) quit(); closefd();}; |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
76 void init() {pending = 0; buffer[0] = '\0';}; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
77 void append(const char *c) {strncat(buffer, c, max(0, maxlen-1-(int)strlen(c)));}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
78 bool err() {return error;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
79 void now() {stamp = time(NULL);}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
80 time_t get_stamp() {return stamp;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
81 int get_fd() {return fd;}; |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
82 void set_id(const char *id) {strncpy(queueid, id, qlen); queueid[qlen-1] = '\0';}; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
83 int writer(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
84 int reader(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
85 int read_line(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
86 int read_response(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
87 void flush_line(int r); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
88 int cmd(const char *c); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
89 int helo(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
90 int rset(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
91 int from(const char *f); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
92 int rcpt(const char *t); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
93 int quit(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
94 void closefd(); |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
95 void log(const char *m, int v); |
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
96 void log(const char *m, const char *v); |
94 | 97 }; |
98 | |
99 class VERIFY { | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
100 const char *host; // host to be used to verify recipient addresses |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
101 time_t last_err; // time of last socket error |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
102 pthread_mutex_t mutex; // protect the lists of sockets and timestamps |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
103 smtp_list connections;// open sockets, ready to be used |
94 | 104 public: |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
105 VERIFY(const char *h); |
320
e27c24c1974a
more smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
311
diff
changeset
|
106 void log(const char *m, const char *q, const char *v); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
107 void closer(); // if the oldest socket is ancient, close it |
311
f5547e7b3a09
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
310
diff
changeset
|
108 SMTP *get_connection(const char *queueid); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
109 void put_connection(SMTP *conn); |
310
802e2b779ed1
enable smtp verify logging
Carl Byington <carl@five-ten-sg.com>
parents:
278
diff
changeset
|
110 bool ok(const char *queueid, const char *from, const char *to); |
94 | 111 }; |
112 | |
153 | 113 class WHITELISTER { |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
114 const char *fn; // file to use |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
115 int days; // how long do we keep entries |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
116 pthread_mutex_t mutex; // protect the flag and map |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
117 time_t loaded; // when we loaded this file |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
118 bool need; // force writing on new entries |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
119 autowhite_sent rcpts; // recipient map to remember when we sent them mail |
153 | 120 public: |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
121 WHITELISTER(const char *f, int d); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
122 void merge(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
123 void writer(); // dump any changes back to the file |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
124 void sent(const char *to); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
125 bool is_white(const char *from); // should we white list this sender (did we send them anything recently) |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
126 int get_days() {return days;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
127 void set_days(int d) {days = d;}; |
153 | 128 }; |
129 | |
192
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
130 class DELAYWHITE { |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
131 const char *loto; |
192
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
132 WHITELISTERP w; |
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
133 CONTEXTP con; |
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
134 public: |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
135 DELAYWHITE(const char *loto_, WHITELISTERP w_, CONTEXTP con_); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
136 const char *get_loto() {return loto;}; |
192
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
137 WHITELISTERP get_w() {return w;}; |
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
138 CONTEXTP get_con() {return con;}; |
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
139 }; |
8f4a9a37d4d9
delay autowhitelisting to avoid out of office reply bots
carl
parents:
179
diff
changeset
|
140 |
321
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
141 struct DKIM { |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
142 const char *action; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
143 const char *signer; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
144 public: |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
145 DKIM(const char *action_, const char *signer_); |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
146 }; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
147 |
94 | 148 struct DNSBL { |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
149 const char *name; // nickname for this dns based list |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
150 const char *suffix; // blacklist suffix like blackholes.five-ten-sg.com |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
151 const char *message; // error message with one or two %s operators for the ip address replacement |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
152 DNSBL(const char *n, const char *s, const char *m); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
153 bool operator==(const DNSBL &rhs); |
94 | 154 }; |
155 | |
249 | 156 struct DNSWL { |
157 const char *name; // nickname for this dns based list | |
158 const char *suffix; // whitelist suffix like list.dnswl.org | |
159 int level; // matches 127.0.x.y where y >= level | |
160 DNSWL(const char *n, const char *s, const int l); | |
161 bool operator==(const DNSWL &rhs); | |
162 }; | |
163 | |
94 | 164 class CONTEXT { |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
165 CONTEXTP parent; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
166 const char * name; |
278
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
167 context_map children; // map child context names to their contexts |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
168 string_set env_to; // this context applies to these envelope recipients |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
169 const char * verify_host; // use this smtp host to verify email addresses |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
170 VERIFYP verifier; // pointer to the verifier structure |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
171 const char * generic_regx; // pointer to generic regular expression |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
172 const char * generic_message; // pointer to generic message with one %s |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
173 regex_t generic_pattern; // compiled regex pattern |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
174 const char * white_regx; // pointer to whitelist regular expression |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
175 regex_t white_pattern; // compiled regex pattern |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
176 const char * autowhite_file; // file to use for automatic whitelisting |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
177 WHITELISTERP whitelister; // pointer to the auto whitelister structure |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
178 string_map env_from; // map senders to white/black/unknown |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
179 context_map env_from_context; // map senders to a child context |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
180 const char * env_from_default; // default value for senders that are not found in the map white/black/unknown/inherit |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
181 bool content_filtering; // |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
182 const char * content_suffix; // for url body filtering based on ip addresses of hostnames in the body |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
183 const char * content_message; // "" |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
184 const char * uribl_suffix; // for uribl body filtering based on hostnames in the body |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
185 const char * uribl_message; // "" |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
186 string_set content_host_ignore; // hosts to ignore for content sbl checking |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
187 string_set content_tlds; // names that are tlds |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
188 string_set content_tldwilds; // *.names that are tlds |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
189 string_set content_tldnots; // names that are not tlds |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
190 string_set html_tags; // set of valid html tags |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
191 int host_limit; // limit on host names |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
192 const char * host_limit_message; // error message for excessive host names |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
193 bool host_random; // pick a random selection of host names rather than error for excessive hosts |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
194 int tag_limit; // limit on bad html tags |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
195 const char * tag_limit_message; // error message for excessive bad html tags |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
196 int spamassassin_limit; // max score from spamassassin |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
197 bool require_match; // require matching context filtering context |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
198 bool require_rdns; // require proper rdns on client ip |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
199 bool dcc_greylist; // should we do dcc greylisting? |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
200 int dcc_bulk_threshold; // off = 0, many = 1000 |
321
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
201 dkimp_map dkim_from_names; // map header from domains to dkim constraints |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
202 string_map dkim_signer_names; // map dkim signers to actions |
278
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
203 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
204 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
205 bool dnsbl_list_parsed; // true iff we have actually parsed a dnsbl_list |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
206 dnswlp_map dnswl_names; // name to dnswl mapping for lists that are available in this context and children |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
207 dnswlp_list dnswl_list; // list of dnswls to be used in this context |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
208 bool dnswl_list_parsed; // true iff we have actually parsed a dnswl_list |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
209 int default_rate_limit; // if not specified per user |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
210 int default_address_limit; // if not specified per user |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
211 int daily_rate_multiple; // daily multiplier applied to hourly rate |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
212 int daily_address_multiple; // daily multiplier applied to hourly rate |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
213 rates rcpt_per_hour; // per user limits on number of recipients per hour |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
214 rates addresses_per_hour; // per user limits on number of unique ip address connections per hour |
136 | 215 |
94 | 216 |
217 public: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
218 CONTEXT(CONTEXTP parent_, const char *name_); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
219 ~CONTEXT(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
220 CONTEXTP get_parent() {return parent;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
221 bool is_parent(CONTEXTP p); // is p a parent of this? |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
222 const char* get_full_name(char *buffer, int size); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
223 void add_context(CONTEXTP child) {children[child->name] = child;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
224 bool allow_env_to(const char *to) {return (parent) ? parent->cover_env_to(to) : true;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
225 bool cover_env_to(const char *to); |
94 | 226 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
227 void set_verifier(VERIFYP v) {verifier = v;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
228 void set_verify(const char *host) {verify_host = host;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
229 const char* get_verify() {return verify_host;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
230 VERIFYP find_verify(const char *to); |
94 | 231 |
168 | 232 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
233 void set_whitelister(WHITELISTERP v) {whitelister = v;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
234 void set_autowhite(const char *fn) {autowhite_file = fn;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
235 const char* get_autowhite() {return autowhite_file;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
236 WHITELISTERP find_autowhite(const char *from, const char *to); |
153 | 237 |
278
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
238 void set_default_rate_limit(int limit) {default_rate_limit = limit;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
239 void set_default_address_limit(int limit) {default_address_limit = limit;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
240 void set_daily_rate_multiple(int multiple) {daily_rate_multiple = multiple;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
241 void set_daily_address_multiple(int multiple) {daily_address_multiple = multiple;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
242 void add_rate_limit(const char *user, int limit) {rcpt_per_hour[user] = limit;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
243 void add_address_limit(const char *user, int limit) {addresses_per_hour[user] = limit;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
244 int find_rate_limit(const char *user); // recipients per hour/day |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
245 int find_address_limit(const char *user); // unique ip address connections per hour/day |
259
be939802c64e
add recipient rate limits by email from address or domain
Carl Byington <carl@five-ten-sg.com>
parents:
255
diff
changeset
|
246 bool is_unauthenticated_limited(const char *user); |
278
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
247 int get_daily_rate_multiple() {return daily_rate_multiple;}; |
368572c57013
add limits on unique ip addresses per hour per authenticated user
Carl Byington <carl@five-ten-sg.com>
parents:
272
diff
changeset
|
248 int get_daily_address_multiple() {return daily_address_multiple;}; |
136 | 249 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
250 void add_to(const char *to) {env_to.insert(to);}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
251 void add_from(const char *from, const char *status) {env_from[from] = status;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
252 void add_from_context(const char *from, CONTEXTP con) {env_from_context[from] = con;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
253 void set_from_default(const char *status) {env_from_default = status;}; |
233
5c3e9bf45bb5
Add whitelisting by regex expression filtering.
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
254 const char* find_from(const char *from, bool update_white = false, const char *queueid = NULL); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
255 CONTEXTP find_context(const char *from); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
256 CONTEXTP find_from_context_name(const char *name); |
94 | 257 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
258 void set_content_filtering(bool filter) {content_filtering = filter; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
259 void set_content_suffix(const char *suffix) {content_suffix = suffix; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
260 void set_content_message(const char *message) {content_message = message; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
261 void set_uribl_suffix(const char *suffix) {uribl_suffix = suffix; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
262 void set_uribl_message(const char *message) {uribl_message = message; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
263 void add_ignore(const char *host) {content_host_ignore.insert(host);}; |
272
a99b6c1f5f67
Code cleanup, increase minimum hostname length for uribl checking
Carl Byington <carl@five-ten-sg.com>
parents:
270
diff
changeset
|
264 void add_tld(const char *tld) {content_tlds.insert(tld); }; |
a99b6c1f5f67
Code cleanup, increase minimum hostname length for uribl checking
Carl Byington <carl@five-ten-sg.com>
parents:
270
diff
changeset
|
265 void add_tldwild(const char *tld) {content_tldwilds.insert(tld); }; |
a99b6c1f5f67
Code cleanup, increase minimum hostname length for uribl checking
Carl Byington <carl@five-ten-sg.com>
parents:
270
diff
changeset
|
266 void add_tldnot(const char *tld) {content_tldnots.insert(tld); }; |
94 | 267 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
268 void set_host_limit(int limit) {host_limit = limit; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
269 void set_host_message(const char *message) {host_limit_message = message;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
270 void set_host_random(bool random) {host_random = random; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
271 void set_spamassassin_limit(int limit) {spamassassin_limit = limit; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
272 void set_tag_limit(int limit) {tag_limit = limit; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
273 void set_tag_message(const char *message) {tag_limit_message = message;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
274 void add_tag(const char *tag) {html_tags.insert(tag); }; |
94 | 275 |
321
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
276 const char *find_dkim_signer(const char *name); |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
277 void add_dkim_signer(const char *signer, const char *action) |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
278 {dkim_signer_names[signer] = action;}; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
279 DKIMP find_dkim_from(const char *name); |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
280 void add_dkim_from(const char *from, const char *action, const char *signer) |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
281 {dkim_from_names[from] = new DKIM(action,signer);}; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
282 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
283 void add_dnsbl(const char *name, DNSBLP dns) {dnsbl_names[name] = dns; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
284 void add_dnsbl(DNSBLP dns) {dnsbl_list.push_back(dns);}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
285 DNSBLP find_dnsbl(const char *name); |
255
d6d5c50b9278
Allow dnswl_list and dnsbl_list to be empty, to override lists specified in the ancestor contexts. Add daily recipient limits as a multiple of the hourly limits.
Carl Byington <carl@five-ten-sg.com>
parents:
249
diff
changeset
|
286 void set_dnsbll_parsed() {dnsbl_list_parsed = true;}; |
94 | 287 |
249 | 288 void add_dnswl(const char *name, DNSWLP dns) {dnswl_names[name] = dns; }; |
289 void add_dnswl(DNSWLP dns) {dnswl_list.push_back(dns);}; | |
290 DNSWLP find_dnswl(const char *name); | |
255
d6d5c50b9278
Allow dnswl_list and dnsbl_list to be empty, to override lists specified in the ancestor contexts. Add daily recipient limits as a multiple of the hourly limits.
Carl Byington <carl@five-ten-sg.com>
parents:
249
diff
changeset
|
291 void set_dnswll_parsed() {dnswl_list_parsed = true;}; |
249 | 292 |
233
5c3e9bf45bb5
Add whitelisting by regex expression filtering.
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
293 bool set_white(const char *regx); |
5c3e9bf45bb5
Add whitelisting by regex expression filtering.
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
294 bool white_match(const char *from); |
5c3e9bf45bb5
Add whitelisting by regex expression filtering.
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
295 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
296 bool set_generic(const char *regx, const char *msg); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
297 const char* generic_match(const char *client); |
168 | 298 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
299 void set_require(bool r) {require_match = r; }; |
268
f941563c2a95
Add require_rdns checking
Carl Byington <carl@five-ten-sg.com>
parents:
259
diff
changeset
|
300 void set_requirerdns(bool r) {require_rdns = r; }; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
301 void set_grey(bool g) {dcc_greylist = g; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
302 void set_bulk(int b) {dcc_bulk_threshold = b; }; |
178 | 303 |
268
f941563c2a95
Add require_rdns checking
Carl Byington <carl@five-ten-sg.com>
parents:
259
diff
changeset
|
304 bool get_content_filtering() {return content_filtering; }; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
305 bool get_require() {return content_filtering && require_match; }; |
268
f941563c2a95
Add require_rdns checking
Carl Byington <carl@five-ten-sg.com>
parents:
259
diff
changeset
|
306 bool get_requirerdns() {return require_rdns; }; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
307 bool get_grey() {return content_filtering && dcc_greylist; }; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
308 int get_bulk() {return (content_filtering) ? dcc_bulk_threshold : 0;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
309 int get_host_limit() {return (content_filtering) ? host_limit : 0;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
310 bool get_host_random() {return (content_filtering) ? host_random : 0;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
311 int get_spamassassin_limit() {return (content_filtering) ? spamassassin_limit : 0;}; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
312 const char* get_content_suffix(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
313 const char* get_content_message(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
314 const char* get_uribl_suffix(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
315 const char* get_uribl_message(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
316 string_set& get_content_host_ignore(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
317 string_set& get_content_tlds(); |
270
f92f24950bd3
Use mozilla prefix list for tld checking, Enable surbl/uribl/dbl rhs lists
Carl Byington <carl@five-ten-sg.com>
parents:
268
diff
changeset
|
318 string_set& get_content_tldwilds(); |
f92f24950bd3
Use mozilla prefix list for tld checking, Enable surbl/uribl/dbl rhs lists
Carl Byington <carl@five-ten-sg.com>
parents:
268
diff
changeset
|
319 string_set& get_content_tldnots(); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
320 string_set& get_html_tags(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
321 dnsblp_list& get_dnsbl_list(); |
249 | 322 dnswlp_list& get_dnswl_list(); |
94 | 323 |
329
c9932c4d8053
allow multiple dkim signers in authentication results
Carl Byington <carl@five-ten-sg.com>
parents:
326
diff
changeset
|
324 void log(const char *queueid, const char *msg, const char *v); |
360
17f21fcd44a8
allow quoted comma separated multiple signers in the dkim_from config entries
Carl Byington <carl@five-ten-sg.com>
parents:
331
diff
changeset
|
325 bool in_signing_set(const char *s, const char *signers); |
421
22027ad2a28f
spf code now handles %{d} and %{h} macros; use envelope from value for spf if it is a subdomain of the header from domain
Carl Byington <carl@five-ten-sg.com>
parents:
382
diff
changeset
|
326 void replace(char *buf, char *p, const char *what); |
423
c9b7b6dd1206
use both envelope from and header from for spf checks when envelope from is a subdomain of the header from domain
Carl Byington <carl@five-ten-sg.com>
parents:
421
diff
changeset
|
327 bool resolve_spf(const char *from, uint32_t ip, mlfiPriv *priv); |
c9b7b6dd1206
use both envelope from and header from for spf checks when envelope from is a subdomain of the header from domain
Carl Byington <carl@five-ten-sg.com>
parents:
421
diff
changeset
|
328 bool resolve_one_spf(const char *from, uint32_t ip, mlfiPriv *priv, int level = 0); |
381
879a470c6ac3
fetch spf txt records for required dkim signers
Carl Byington <carl@five-ten-sg.com>
parents:
360
diff
changeset
|
329 const char *acceptable_content(recorder &memory, int score, int bulk, const char *queueid, string_set &signers, const char *from, mlfiPriv *priv, string& msg); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
330 bool ignore_host(const char *host); |
94 | 331 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
332 void dump(bool isdefault, bool &spamass, int level = 0); |
94 | 333 }; |
334 | |
335 | |
336 struct CONFIG { | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
337 // the only mutable stuff once it has been loaded from the config file |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
338 int reference_count; // protected by the global config_mutex |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
339 // all the rest is constant after loading from the config file |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
340 int generation; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
341 time_t load_time; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
342 string_set config_files; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
343 context_list contexts; // owns all the contexts, not just top level contexts |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
344 context_map env_to; // map recipient to a filtering context |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
345 CONTEXTP default_context;// for env_to values that don't have their own specific filtering context |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
346 // the default context is also used for some of the content filtering values |
94 | 347 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
348 CONFIG(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
349 ~CONFIG(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
350 void add_context(CONTEXTP con); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
351 void add_to(const char *to, CONTEXTP con); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
352 CONTEXTP find_context(const char *to); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
353 void dump(); |
94 | 354 }; |
355 | |
136 | 356 |
270
f92f24950bd3
Use mozilla prefix list for tld checking, Enable surbl/uribl/dbl rhs lists
Carl Byington <carl@five-ten-sg.com>
parents:
268
diff
changeset
|
357 extern const char *token_asterisk; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
358 extern const char *token_autowhite; |
270
f92f24950bd3
Use mozilla prefix list for tld checking, Enable surbl/uribl/dbl rhs lists
Carl Byington <carl@five-ten-sg.com>
parents:
268
diff
changeset
|
359 extern const char *token_bang; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
360 extern const char *token_black; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
361 extern const char *token_content; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
362 extern const char *token_context; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
363 extern const char *token_dccbulk; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
364 extern const char *token_dccfrom; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
365 extern const char *token_dccgrey; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
366 extern const char *token_dccto; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
367 extern const char *token_default; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
368 extern const char *token_dnsbl; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
369 extern const char *token_dnsbll; |
249 | 370 extern const char *token_dnswl; |
371 extern const char *token_dnswll; | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
372 extern const char *token_envfrom; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
373 extern const char *token_envto; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
374 extern const char *token_filter; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
375 extern const char *token_generic; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
376 extern const char *token_host_limit; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
377 extern const char *token_html_limit; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
378 extern const char *token_html_tags; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
379 extern const char *token_ignore; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
380 extern const char *token_include; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
381 extern const char *token_inherit; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
382 extern const char *token_lbrace; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
383 extern const char *token_mailhost; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
384 extern const char *token_many; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
385 extern const char *token_no; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
386 extern const char *token_off; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
387 extern const char *token_ok; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
388 extern const char *token_ok2; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
389 extern const char *token_on; |
270
f92f24950bd3
Use mozilla prefix list for tld checking, Enable surbl/uribl/dbl rhs lists
Carl Byington <carl@five-ten-sg.com>
parents:
268
diff
changeset
|
390 extern const char *token_period; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
391 extern const char *token_rate; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
392 extern const char *token_rbrace; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
393 extern const char *token_require; |
268
f941563c2a95
Add require_rdns checking
Carl Byington <carl@five-ten-sg.com>
parents:
259
diff
changeset
|
394 extern const char *token_requirerdns; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
395 extern const char *token_semi; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
396 extern const char *token_soft; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
397 extern const char *token_spamassassin; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
398 extern const char *token_substitute; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
399 extern const char *token_tld; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
400 extern const char *token_unknown; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
401 extern const char *token_uribl; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
402 extern const char *token_verify; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
403 extern const char *token_white; |
233
5c3e9bf45bb5
Add whitelisting by regex expression filtering.
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
404 extern const char *token_white_regex; |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
405 extern const char *token_yes; |
322
9f8411f3919c
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
321
diff
changeset
|
406 extern const char *token_dkim_signer; |
9f8411f3919c
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
321
diff
changeset
|
407 extern const char *token_dkim_from; |
321
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
408 extern const char *token_signed_white; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
409 extern const char *token_signed_black; |
e172dc10fe24
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
320
diff
changeset
|
410 extern const char *token_require_signed; |
322
9f8411f3919c
add dkim white/black listing
Carl Byington <carl@five-ten-sg.com>
parents:
321
diff
changeset
|
411 extern const char *token_myhostname; |
94 | 412 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
413 extern pthread_mutex_t verifier_mutex; // protect the verifier map |
153 | 414 extern pthread_mutex_t whitelister_mutex; // protect the |
94 | 415 |
416 void discard(string_set &s); | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
417 const char* register_string(string_set &s, const char *name); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
418 const char* register_string(const char *name); |
164 | 419 void clear_strings(); |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
192
diff
changeset
|
420 bool load_conf(CONFIG &dc, const char *fn); |
94 | 421 void* verify_closer(void *arg); |
153 | 422 void* whitelister_writer(void *arg); |
94 | 423 void token_init(); |
424 | |
425 #endif |