Mercurial > dnsbl
comparison src/context.h @ 214:82886d4dd71f stable-6-0-19
Fixes to compile on Fedora 9 and for const correctness.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 10 Jun 2008 08:58:42 -0700 |
parents | 8f4a9a37d4d9 |
children | 5c3e9bf45bb5 |
comparison
equal
deleted
inserted
replaced
213:44ffef730bc4 | 214:82886d4dd71f |
---|---|
7 */ | 7 */ |
8 | 8 |
9 #ifndef context_include | 9 #ifndef context_include |
10 #define context_include | 10 #define context_include |
11 | 11 |
12 #include "tokenizer.h" | 12 enum status {oksofar, // not rejected yet |
13 #include <map> | 13 white, // whitelisted |
14 #include <regex.h> | 14 black, // blacklisted |
15 | 15 reject}; // rejected by a dns list |
16 | |
17 enum status {oksofar, // not rejected yet | |
18 white, // whitelisted | |
19 black, // blacklisted | |
20 reject}; // rejected by a dns list | |
21 | 16 |
22 class DNSBL; | 17 class DNSBL; |
23 class CONTEXT; | 18 class CONTEXT; |
24 class VERIFY; | 19 class VERIFY; |
25 class SMTP; | 20 class SMTP; |
26 class WHITELISTER; | 21 class WHITELISTER; |
27 class DELAYWHITE; | 22 class DELAYWHITE; |
28 class recorder; | 23 class recorder; |
29 | 24 |
30 typedef map<char *, char *, ltstr> string_map; | 25 typedef map<const char *, const char *, ltstr> string_map; |
31 typedef set<int> int_set; | 26 typedef set<int> int_set; |
32 typedef list<SMTP *> smtp_list; | 27 typedef list<SMTP *> smtp_list; |
33 typedef list<char *> string_list; | 28 typedef DNSBL * DNSBLP; |
34 typedef DNSBL * DNSBLP; | 29 typedef VERIFY * VERIFYP; |
35 typedef VERIFY * VERIFYP; | 30 typedef WHITELISTER * WHITELISTERP; |
36 typedef WHITELISTER * WHITELISTERP; | 31 typedef DELAYWHITE * DELAYWHITEP; |
37 typedef DELAYWHITE * DELAYWHITEP; | 32 typedef list<DNSBLP> dnsblp_list; |
38 typedef list<DNSBLP> dnsblp_list; | 33 typedef map<const char *, DNSBLP, ltstr> dnsblp_map; |
39 typedef map<char *, DNSBLP, ltstr> dnsblp_map; | 34 typedef CONTEXT * CONTEXTP; |
40 typedef CONTEXT * CONTEXTP; | 35 typedef list<CONTEXTP> context_list; |
41 typedef list<CONTEXTP> context_list; | 36 typedef map<const char *, CONTEXTP, ltstr> context_map; |
42 typedef map<char *, CONTEXTP, ltstr> context_map; | 37 typedef map<const char *, int, ltstr> ns_mapper; |
43 typedef map<char *, int, ltstr> ns_mapper; | 38 typedef map<const char *, int, ltstr> rcpt_rates; |
44 typedef map<char *, int, ltstr> rcpt_rates; | 39 typedef map<const char *, time_t, ltstr> autowhite_sent; |
45 typedef map<char *, time_t, ltstr> autowhite_sent; | 40 typedef map<const char *, VERIFYP, ltstr> verify_map; |
46 typedef map<char *, VERIFYP, ltstr> verify_map; | 41 typedef map<const char *, WHITELISTERP, ltstr> whitelister_map; |
47 typedef map<char *, WHITELISTERP, ltstr> whitelister_map; | 42 typedef list<DELAYWHITEP> delay_whitelist; |
48 typedef list<DELAYWHITEP> delay_whitelist; | |
49 | 43 |
50 class SMTP { | 44 class SMTP { |
51 static const int maxlen = 1000; | 45 static const int maxlen = 1000; |
52 int fd; | 46 int fd; |
53 bool error; | 47 bool error; |
54 time_t stamp; | 48 time_t stamp; |
55 char efrom[maxlen]; // last envelope from sent on this socket | 49 char efrom[maxlen]; // last envelope from sent on this socket |
56 int pending; // unread bytes in buffer, not including the null terminator | 50 int pending; // unread bytes in buffer, not including the null terminator |
57 char buffer[maxlen]; | 51 char buffer[maxlen]; |
58 public: | 52 public: |
59 SMTP(int f) {fd = f; error = false; now(); efrom[0] = '\0'; init();}; | 53 SMTP(int f) {fd = f; error = false; now(); efrom[0] = '\0'; init();}; |
60 ~SMTP() {if (!error) quit(); closefd();}; | 54 ~SMTP() {if (!error) quit(); closefd();}; |
61 void init() {pending = 0; buffer[0] = '\0';}; | 55 void init() {pending = 0; buffer[0] = '\0';}; |
62 void append(char *c) {strncat(buffer, c, max(0, maxlen-1-(int)strlen(c)));}; | 56 void append(const char *c) {strncat(buffer, c, max(0, maxlen-1-(int)strlen(c)));}; |
63 bool err() {return error;}; | 57 bool err() {return error;}; |
64 void now() {stamp = time(NULL);}; | 58 void now() {stamp = time(NULL);}; |
65 time_t get_stamp() {return stamp;}; | 59 time_t get_stamp() {return stamp;}; |
66 int get_fd() {return fd;}; | 60 int get_fd() {return fd;}; |
67 int writer(); | 61 int writer(); |
68 int reader(); | 62 int reader(); |
69 int read_line(); | 63 int read_line(); |
70 int read_response(); | 64 int read_response(); |
71 void flush_line(int r); | 65 void flush_line(int r); |
72 int cmd(char *c); | 66 int cmd(const char *c); |
73 int helo(); | 67 int helo(); |
74 int rset(); | 68 int rset(); |
75 int from(char *f); | 69 int from(const char *f); |
76 int rcpt(char *t); | 70 int rcpt(const char *t); |
77 int quit(); | 71 int quit(); |
78 void closefd(); | 72 void closefd(); |
79 #ifdef VERIFY_DEBUG | 73 #ifdef VERIFY_DEBUG |
80 static void log(char *m, int v); | 74 static void log(const char *m, int v); |
81 static void log(char *m, char *v); | 75 static void log(const char *m, const char *v); |
82 #endif | 76 #endif |
83 }; | 77 }; |
84 | 78 |
85 class VERIFY { | 79 class VERIFY { |
86 char *host; // host to be used to verify recipient addresses | 80 const char *host; // host to be used to verify recipient addresses |
87 time_t last_err; // time of last socket error | 81 time_t last_err; // time of last socket error |
88 pthread_mutex_t mutex; // protect the lists of sockets and timestamps | 82 pthread_mutex_t mutex; // protect the lists of sockets and timestamps |
89 smtp_list connections;// open sockets, ready to be used | 83 smtp_list connections;// open sockets, ready to be used |
90 public: | 84 public: |
91 VERIFY(char *h); | 85 VERIFY(const char *h); |
92 void closer(); // if the oldest socket is ancient, close it | 86 void closer(); // if the oldest socket is ancient, close it |
93 SMTP *get_connection(); | 87 SMTP *get_connection(); |
94 void put_connection(SMTP *conn); | 88 void put_connection(SMTP *conn); |
95 bool ok(char *from, char *to); | 89 bool ok(const char *from, const char *to); |
96 }; | 90 }; |
97 | 91 |
98 class WHITELISTER { | 92 class WHITELISTER { |
99 char *fn; // file to use | 93 const char *fn; // file to use |
100 int days; // how long do we keep entries | 94 int days; // how long do we keep entries |
101 pthread_mutex_t mutex; // protect the flag and map | 95 pthread_mutex_t mutex; // protect the flag and map |
102 time_t loaded; // when we loaded this file | 96 time_t loaded; // when we loaded this file |
103 bool need; // force writing on new entries | 97 bool need; // force writing on new entries |
104 autowhite_sent rcpts; // recipient map to remember when we sent them mail | 98 autowhite_sent rcpts; // recipient map to remember when we sent them mail |
105 public: | 99 public: |
106 WHITELISTER(char *f, int d); | 100 WHITELISTER(const char *f, int d); |
107 void merge(); | 101 void merge(); |
108 void writer(); // dump any changes back to the file | 102 void writer(); // dump any changes back to the file |
109 void sent(char *to); | 103 void sent(const char *to); |
110 bool is_white(char *from); // should we white list this sender (did we send them anything recently) | 104 bool is_white(const char *from); // should we white list this sender (did we send them anything recently) |
111 int get_days() {return days;}; | 105 int get_days() {return days;}; |
112 void set_days(int d) {days = d;}; | 106 void set_days(int d) {days = d;}; |
113 }; | 107 }; |
114 | 108 |
115 class DELAYWHITE { | 109 class DELAYWHITE { |
116 char* loto; | 110 const char *loto; |
117 WHITELISTERP w; | 111 WHITELISTERP w; |
118 CONTEXTP con; | 112 CONTEXTP con; |
119 public: | 113 public: |
120 DELAYWHITE(char *loto_, WHITELISTERP w_, CONTEXTP con_); | 114 DELAYWHITE(const char *loto_, WHITELISTERP w_, CONTEXTP con_); |
121 char *get_loto() {return loto;}; | 115 const char *get_loto() {return loto;}; |
122 WHITELISTERP get_w() {return w;}; | 116 WHITELISTERP get_w() {return w;}; |
123 CONTEXTP get_con() {return con;}; | 117 CONTEXTP get_con() {return con;}; |
124 }; | 118 }; |
125 | 119 |
126 struct DNSBL { | 120 struct DNSBL { |
127 char *name; // nickname for this dns based list | 121 const char *name; // nickname for this dns based list |
128 char *suffix; // blacklist suffix like blackholes.five-ten-sg.com | 122 const char *suffix; // blacklist suffix like blackholes.five-ten-sg.com |
129 char *message; // error message with one or two %s operators for the ip address replacement | 123 const char *message; // error message with one or two %s operators for the ip address replacement |
130 DNSBL(char *n, char *s, char *m); | 124 DNSBL(const char *n, const char *s, const char *m); |
131 bool operator==(const DNSBL &rhs); | 125 bool operator==(const DNSBL &rhs); |
132 }; | 126 }; |
133 | 127 |
134 class CONTEXT { | 128 class CONTEXT { |
135 CONTEXTP parent; | 129 CONTEXTP parent; |
136 char * name; | 130 const char * name; |
137 context_map children; // map child context names to their contexts | 131 context_map children; // map child context names to their contexts |
138 string_set env_to; // this context applies to these envelope recipients | 132 string_set env_to; // this context applies to these envelope recipients |
139 char * verify_host; // use this smtp host to verify email addresses | 133 const char * verify_host; // use this smtp host to verify email addresses |
140 VERIFYP verifier; // pointer to the verifier structure | 134 VERIFYP verifier; // pointer to the verifier structure |
141 char * generic_regx; // pointer to generic regular expression | 135 const char * generic_regx; // pointer to generic regular expression |
142 char * generic_message; // pointer to generic message with one %s | 136 const char * generic_message; // pointer to generic message with one %s |
143 regex_t generic_pattern; // compiled regex pattern | 137 regex_t generic_pattern; // compiled regex pattern |
144 char * autowhite_file; // file to use for automatic whitelisting | 138 const char * autowhite_file; // file to use for automatic whitelisting |
145 WHITELISTERP whitelister; // pointer to the auto whitelister structure | 139 WHITELISTERP whitelister; // pointer to the auto whitelister structure |
146 string_map env_from; // map senders to white/black/unknown | 140 string_map env_from; // map senders to white/black/unknown |
147 context_map env_from_context; // map senders to a child context | 141 context_map env_from_context; // map senders to a child context |
148 char * env_from_default; // default value for senders that are not found in the map white/black/unknown/inherit | 142 const char * env_from_default; // default value for senders that are not found in the map white/black/unknown/inherit |
149 bool content_filtering; // | 143 bool content_filtering; // |
150 char * content_suffix; // for url body filtering based on ip addresses of hostnames in the body | 144 const char * content_suffix; // for url body filtering based on ip addresses of hostnames in the body |
151 char * content_message; // "" | 145 const char * content_message; // "" |
152 char * uribl_suffix; // for uribl body filtering based on hostnames in the body | 146 const char * uribl_suffix; // for uribl body filtering based on hostnames in the body |
153 char * uribl_message; // "" | 147 const char * uribl_message; // "" |
154 string_set content_host_ignore;// hosts to ignore for content sbl checking | 148 string_set content_host_ignore;// hosts to ignore for content sbl checking |
155 string_set content_tlds; // | 149 string_set content_tlds; // |
156 string_set content_cctlds; // | 150 string_set content_cctlds; // |
157 string_set html_tags; // set of valid html tags | 151 string_set html_tags; // set of valid html tags |
158 int host_limit; // limit on host names | 152 int host_limit; // limit on host names |
159 char * host_limit_message; // error message for excessive host names | 153 const char * host_limit_message; // error message for excessive host names |
160 bool host_random; // pick a random selection of host names rather than error for excessive hosts | 154 bool host_random; // pick a random selection of host names rather than error for excessive hosts |
161 int tag_limit; // limit on bad html tags | 155 int tag_limit; // limit on bad html tags |
162 char * tag_limit_message; // error message for excessive bad html tags | 156 const char * tag_limit_message; // error message for excessive bad html tags |
163 int spamassassin_limit; // max score from spamassassin | 157 int spamassassin_limit; // max score from spamassassin |
164 bool require_match; // require matching context filtering context | 158 bool require_match; // require matching context filtering context |
165 bool dcc_greylist; // should we do dcc greylisting? | 159 bool dcc_greylist; // should we do dcc greylisting? |
166 int dcc_bulk_threshold; // off = 0, many = 1000 | 160 int dcc_bulk_threshold; // off = 0, many = 1000 |
167 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children | 161 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children |
168 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context | 162 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context |
169 int default_rcpt_rate; // if not specified per user | 163 int default_rcpt_rate; // if not specified per user |
170 rcpt_rates rcpt_per_hour; // per user limits on number of recipients per hour | 164 rcpt_rates rcpt_per_hour; // per user limits on number of recipients per hour |
171 | 165 |
172 | 166 |
173 public: | 167 public: |
174 CONTEXT(CONTEXTP parent_, char *name_); | 168 CONTEXT(CONTEXTP parent_, const char *name_); |
175 ~CONTEXT(); | 169 ~CONTEXT(); |
176 CONTEXTP get_parent() {return parent;}; | 170 CONTEXTP get_parent() {return parent;}; |
177 bool is_parent(CONTEXTP p); // is p a parent of this? | 171 bool is_parent(CONTEXTP p); // is p a parent of this? |
178 char* get_full_name(char *buf, int size); | 172 const char* get_full_name(char *buffer, int size); |
179 void add_context(CONTEXTP child) {children[child->name] = child;}; | 173 void add_context(CONTEXTP child) {children[child->name] = child;}; |
180 bool allow_env_to(char *to) {return (parent) ? parent->cover_env_to(to) : true;}; | 174 bool allow_env_to(const char *to) {return (parent) ? parent->cover_env_to(to) : true;}; |
181 bool cover_env_to(char *to); | 175 bool cover_env_to(const char *to); |
182 | 176 |
183 void set_verifier(VERIFYP v) {verifier = v;}; | 177 void set_verifier(VERIFYP v) {verifier = v;}; |
184 void set_verify(char *host) {verify_host = host;}; | 178 void set_verify(const char *host) {verify_host = host;}; |
185 char* get_verify() {return verify_host;}; | 179 const char* get_verify() {return verify_host;}; |
186 VERIFYP find_verify(char *to); | 180 VERIFYP find_verify(const char *to); |
187 | 181 |
188 | 182 |
189 void set_whitelister(WHITELISTERP v) {whitelister = v;}; | 183 void set_whitelister(WHITELISTERP v) {whitelister = v;}; |
190 void set_autowhite(char *fn) {autowhite_file = fn;}; | 184 void set_autowhite(const char *fn) {autowhite_file = fn;}; |
191 char* get_autowhite() {return autowhite_file;}; | 185 const char* get_autowhite() {return autowhite_file;}; |
192 WHITELISTERP find_autowhite(char *from, char *to); | 186 WHITELISTERP find_autowhite(const char *from, const char *to); |
193 | 187 |
194 void set_default_rate(int limit) {default_rcpt_rate = limit;}; | 188 void set_default_rate(int limit) {default_rcpt_rate = limit;}; |
195 void add_rate(char *user, int limit) {rcpt_per_hour[user] = limit;}; | 189 void add_rate(const char *user, int limit) {rcpt_per_hour[user] = limit;}; |
196 int find_rate(char *user); | 190 int find_rate(const char *user); |
197 | 191 |
198 void add_to(char *to) {env_to.insert(to);}; | 192 void add_to(const char *to) {env_to.insert(to);}; |
199 void add_from(char *from, char *status) {env_from[from] = status;}; | 193 void add_from(const char *from, const char *status) {env_from[from] = status;}; |
200 void add_from_context(char *from, CONTEXTP con) {env_from_context[from] = con;}; | 194 void add_from_context(const char *from, CONTEXTP con) {env_from_context[from] = con;}; |
201 void set_from_default(char *status) {env_from_default = status;}; | 195 void set_from_default(const char *status) {env_from_default = status;}; |
202 char* find_from(char *from, bool update_white = false); | 196 const char* find_from(const char *from, bool update_white = false); |
203 CONTEXTP find_context(char *from); | 197 CONTEXTP find_context(const char *from); |
204 CONTEXTP find_from_context_name(char *name); | 198 CONTEXTP find_from_context_name(const char *name); |
205 | 199 |
206 void set_content_filtering(bool filter) {content_filtering = filter; }; | 200 void set_content_filtering(bool filter) {content_filtering = filter; }; |
207 void set_content_suffix(char *suffix) {content_suffix = suffix; }; | 201 void set_content_suffix(const char *suffix) {content_suffix = suffix; }; |
208 void set_content_message(char *message) {content_message = message; }; | 202 void set_content_message(const char *message) {content_message = message; }; |
209 void set_uribl_suffix(char *suffix) {uribl_suffix = suffix; }; | 203 void set_uribl_suffix(const char *suffix) {uribl_suffix = suffix; }; |
210 void set_uribl_message(char *message) {uribl_message = message; }; | 204 void set_uribl_message(const char *message) {uribl_message = message; }; |
211 void add_ignore(char *host) {content_host_ignore.insert(host);}; | 205 void add_ignore(const char *host) {content_host_ignore.insert(host);}; |
212 void add_tld(char *tld) {content_tlds.insert(tld); }; | 206 void add_tld(const char *tld) {content_tlds.insert(tld); }; |
213 void add_cctld(char *cctld) {content_cctlds.insert(cctld); }; | 207 void add_cctld(const char *cctld) {content_cctlds.insert(cctld); }; |
214 | 208 |
215 void set_host_limit(int limit) {host_limit = limit; }; | 209 void set_host_limit(int limit) {host_limit = limit; }; |
216 void set_host_message(char *message) {host_limit_message = message;}; | 210 void set_host_message(const char *message) {host_limit_message = message;}; |
217 void set_host_random(bool random) {host_random = random; }; | 211 void set_host_random(bool random) {host_random = random; }; |
218 void set_spamassassin_limit(int limit) {spamassassin_limit = limit; }; | 212 void set_spamassassin_limit(int limit) {spamassassin_limit = limit; }; |
219 void set_tag_limit(int limit) {tag_limit = limit; }; | 213 void set_tag_limit(int limit) {tag_limit = limit; }; |
220 void set_tag_message(char *message) {tag_limit_message = message;}; | 214 void set_tag_message(const char *message) {tag_limit_message = message;}; |
221 void add_tag(char *tag) {html_tags.insert(tag); }; | 215 void add_tag(const char *tag) {html_tags.insert(tag); }; |
222 | 216 |
223 void add_dnsbl(char *name, DNSBLP dns) {dnsbl_names[name] = dns; }; | 217 void add_dnsbl(const char *name, DNSBLP dns) {dnsbl_names[name] = dns; }; |
224 void add_dnsbl(DNSBLP dns) {dnsbl_list.push_back(dns);}; | 218 void add_dnsbl(DNSBLP dns) {dnsbl_list.push_back(dns);}; |
225 DNSBLP find_dnsbl(char *name); | 219 DNSBLP find_dnsbl(const char *name); |
226 | 220 |
227 bool set_generic(char *regx, char *msg); | 221 bool set_generic(const char *regx, const char *msg); |
228 char* generic_match(char *client); | 222 const char* generic_match(const char *client); |
229 | 223 |
230 void set_require(bool r) {require_match = r; }; | 224 void set_require(bool r) {require_match = r; }; |
231 void set_grey(bool g) {dcc_greylist = g; }; | 225 void set_grey(bool g) {dcc_greylist = g; }; |
232 void set_bulk(int b) {dcc_bulk_threshold = b; }; | 226 void set_bulk(int b) {dcc_bulk_threshold = b; }; |
233 | 227 |
234 bool get_content_filtering() {return content_filtering; }; | 228 bool get_content_filtering() {return content_filtering; }; |
235 bool get_require() {return content_filtering && require_match; }; | 229 bool get_require() {return content_filtering && require_match; }; |
236 bool get_grey() {return content_filtering && dcc_greylist; }; | 230 bool get_grey() {return content_filtering && dcc_greylist; }; |
237 int get_bulk() {return (content_filtering) ? dcc_bulk_threshold : 0;}; | 231 int get_bulk() {return (content_filtering) ? dcc_bulk_threshold : 0;}; |
238 int get_host_limit() {return (content_filtering) ? host_limit : 0;}; | 232 int get_host_limit() {return (content_filtering) ? host_limit : 0;}; |
239 bool get_host_random() {return (content_filtering) ? host_random : 0;}; | 233 bool get_host_random() {return (content_filtering) ? host_random : 0;}; |
240 int get_spamassassin_limit() {return (content_filtering) ? spamassassin_limit : 0;}; | 234 int get_spamassassin_limit() {return (content_filtering) ? spamassassin_limit : 0;}; |
241 char* get_content_suffix(); | 235 const char* get_content_suffix(); |
242 char* get_content_message(); | 236 const char* get_content_message(); |
243 char* get_uribl_suffix(); | 237 const char* get_uribl_suffix(); |
244 char* get_uribl_message(); | 238 const char* get_uribl_message(); |
245 string_set& get_content_host_ignore(); | 239 string_set& get_content_host_ignore(); |
246 string_set& get_content_tlds(); | 240 string_set& get_content_tlds(); |
247 string_set& get_content_cctlds(); | 241 string_set& get_content_cctlds(); |
248 string_set& get_html_tags(); | 242 string_set& get_html_tags(); |
249 dnsblp_list& get_dnsbl_list(); | 243 dnsblp_list& get_dnsbl_list(); |
250 | 244 |
251 bool acceptable_content(recorder &memory, int score, int bulk, string& msg); | 245 bool acceptable_content(recorder &memory, int score, int bulk, string& msg); |
252 bool ignore_host(char *host); | 246 bool ignore_host(const char *host); |
253 | 247 |
254 void dump(bool isdefault, bool &spamass, int level = 0); | 248 void dump(bool isdefault, bool &spamass, int level = 0); |
255 }; | 249 }; |
256 | 250 |
257 | 251 |
258 struct CONFIG { | 252 struct CONFIG { |
259 // the only mutable stuff once it has been loaded from the config file | 253 // the only mutable stuff once it has been loaded from the config file |
260 int reference_count; // protected by the global config_mutex | 254 int reference_count; // protected by the global config_mutex |
261 // all the rest is constant after loading from the config file | 255 // all the rest is constant after loading from the config file |
262 int generation; | 256 int generation; |
263 time_t load_time; | 257 time_t load_time; |
264 string_set config_files; | 258 string_set config_files; |
265 context_list contexts; // owns all the contexts, not just top level contexts | 259 context_list contexts; // owns all the contexts, not just top level contexts |
266 context_map env_to; // map recipient to a filtering context | 260 context_map env_to; // map recipient to a filtering context |
267 CONTEXTP default_context;// for env_to values that don't have their own specific filtering context | 261 CONTEXTP default_context;// for env_to values that don't have their own specific filtering context |
268 // the default context is also used for some of the content filtering values | 262 // the default context is also used for some of the content filtering values |
269 | 263 |
270 CONFIG(); | 264 CONFIG(); |
271 ~CONFIG(); | 265 ~CONFIG(); |
272 void add_context(CONTEXTP con); | 266 void add_context(CONTEXTP con); |
273 void add_to(char *to, CONTEXTP con); | 267 void add_to(const char *to, CONTEXTP con); |
274 CONTEXTP find_context(char *to); | 268 CONTEXTP find_context(const char *to); |
275 void dump(); | 269 void dump(); |
276 }; | 270 }; |
277 | 271 |
278 | 272 |
279 extern char *token_autowhite; | 273 extern const char *token_autowhite; |
280 extern char *token_black; | 274 extern const char *token_black; |
281 extern char *token_cctld; | 275 extern const char *token_cctld; |
282 extern char *token_content; | 276 extern const char *token_content; |
283 extern char *token_context; | 277 extern const char *token_context; |
284 extern char *token_dccbulk; | 278 extern const char *token_dccbulk; |
285 extern char *token_dccfrom; | 279 extern const char *token_dccfrom; |
286 extern char *token_dccgrey; | 280 extern const char *token_dccgrey; |
287 extern char *token_dccto; | 281 extern const char *token_dccto; |
288 extern char *token_default; | 282 extern const char *token_default; |
289 extern char *token_dnsbl; | 283 extern const char *token_dnsbl; |
290 extern char *token_dnsbll; | 284 extern const char *token_dnsbll; |
291 extern char *token_envfrom; | 285 extern const char *token_envfrom; |
292 extern char *token_envto; | 286 extern const char *token_envto; |
293 extern char *token_filter; | 287 extern const char *token_filter; |
294 extern char *token_generic; | 288 extern const char *token_generic; |
295 extern char *token_host_limit; | 289 extern const char *token_host_limit; |
296 extern char *token_html_limit; | 290 extern const char *token_html_limit; |
297 extern char *token_html_tags; | 291 extern const char *token_html_tags; |
298 extern char *token_ignore; | 292 extern const char *token_ignore; |
299 extern char *token_include; | 293 extern const char *token_include; |
300 extern char *token_inherit; | 294 extern const char *token_inherit; |
301 extern char *token_lbrace; | 295 extern const char *token_lbrace; |
302 extern char *token_mailhost; | 296 extern const char *token_mailhost; |
303 extern char *token_many; | 297 extern const char *token_many; |
304 extern char *token_no; | 298 extern const char *token_no; |
305 extern char *token_off; | 299 extern const char *token_off; |
306 extern char *token_ok; | 300 extern const char *token_ok; |
307 extern char *token_ok2; | 301 extern const char *token_ok2; |
308 extern char *token_on; | 302 extern const char *token_on; |
309 extern char *token_rate; | 303 extern const char *token_rate; |
310 extern char *token_rbrace; | 304 extern const char *token_rbrace; |
311 extern char *token_require; | 305 extern const char *token_require; |
312 extern char *token_semi; | 306 extern const char *token_semi; |
313 extern char *token_soft; | 307 extern const char *token_soft; |
314 extern char *token_spamassassin; | 308 extern const char *token_spamassassin; |
315 extern char *token_substitute; | 309 extern const char *token_substitute; |
316 extern char *token_tld; | 310 extern const char *token_tld; |
317 extern char *token_unknown; | 311 extern const char *token_unknown; |
318 extern char *token_uribl; | 312 extern const char *token_uribl; |
319 extern char *token_verify; | 313 extern const char *token_verify; |
320 extern char *token_white; | 314 extern const char *token_white; |
321 extern char *token_yes; | 315 extern const char *token_yes; |
322 | 316 |
323 extern pthread_mutex_t verifier_mutex; // protect the verifier map | 317 extern pthread_mutex_t verifier_mutex; // protect the verifier map |
324 extern pthread_mutex_t whitelister_mutex; // protect the | 318 extern pthread_mutex_t whitelister_mutex; // protect the |
325 | 319 |
326 void discard(string_set &s); | 320 void discard(string_set &s); |
327 char* register_string(string_set &s, char *name); | 321 const char* register_string(string_set &s, const char *name); |
328 char* register_string(char *name); | 322 const char* register_string(const char *name); |
329 void clear_strings(); | 323 void clear_strings(); |
330 CONFIG *parse_config(char *fn); | 324 bool load_conf(CONFIG &dc, const char *fn); |
331 bool load_conf(CONFIG &dc, char *fn); | |
332 void* verify_closer(void *arg); | 325 void* verify_closer(void *arg); |
333 void* whitelister_writer(void *arg); | 326 void* whitelister_writer(void *arg); |
334 void token_init(); | 327 void token_init(); |
335 | 328 |
336 #endif | 329 #endif |