Mercurial > dnsbl
annotate src/context.h @ 90:962a1f8f1d9f stable-5-4
add verify statement to verify addresses with better mx host
author | carl |
---|---|
date | Sun, 18 Sep 2005 10:19:58 -0700 |
parents | c1280cd3e248 |
children | 505e77188317 |
rev | line source |
---|---|
90
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
1 #ifndef context_include |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
2 #define context_include |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
3 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
4 #include "tokenizer.h" |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
5 #include <map> |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
6 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
7 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
8 enum status {oksofar, // not rejected yet |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
9 white, // whitelisted |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
10 black, // blacklisted |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
11 reject}; // rejected by a dns list |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
12 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
13 class DNSBL; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
14 class CONTEXT; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
15 class VERIFY; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
16 class recorder; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
17 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
18 typedef map<char *, char *, ltstr> string_map; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
19 typedef set<int> int_set; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
20 typedef list<int> fd_list; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
21 typedef list<time_t> time_list; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
22 typedef list<char *> string_list; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
23 typedef DNSBL * DNSBLP; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
24 typedef VERIFY * VERIFYP; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
25 typedef list<DNSBLP> dnsblp_list; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
26 typedef map<char *, DNSBLP, ltstr> dnsblp_map; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
27 typedef CONTEXT * CONTEXTP; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
28 typedef list<CONTEXTP> context_list; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
29 typedef map<char *, CONTEXTP, ltstr> context_map; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
30 typedef map<char *, int, ltstr> ns_mapper; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
31 typedef map<char *, VERIFYP, ltstr> verify_map; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
32 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
33 class SMTP { |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
34 static const int maxlen = 1000; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
35 int fd; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
36 bool error; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
37 int pending; // unread bytes in buffer, not including the null terminator |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
38 char buffer[maxlen]; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
39 public: |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
40 SMTP(int f) {fd = f; error = false;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
41 void init() {pending = 0; buffer[0] = '\0';}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
42 void append(char *c) {strncat(buffer, c, max(0, maxlen-1-(int)strlen(c)));}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
43 bool err() {return error;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
44 int writer(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
45 int reader(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
46 int read_line(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
47 int read_response(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
48 int flush_line(int r); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
49 int cmd(char *c); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
50 int helo(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
51 int rset(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
52 int from(char *f); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
53 int rcpt(char *t); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
54 int quit(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
55 // static void log(char *m, int v); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
56 // static void log(char *m, char *v); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
57 }; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
58 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
59 class VERIFY { |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
60 char *host; // host to be used to verify recipient addresses |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
61 time_t last_err; // time of last socket error |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
62 pthread_mutex_t mutex; // protect the lists of sockets and timestamps |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
63 fd_list sockets; // open sockets, ready to be used |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
64 time_list times; // last timestamp when this socket was used |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
65 public: |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
66 VERIFY(char *h); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
67 void closer(); // if the oldest socket is ancient, close it |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
68 int get_socket(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
69 void put_socket(int fd, bool err); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
70 bool ok(char *from, char *to); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
71 }; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
72 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
73 struct DNSBL { |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
74 char *name; // nickname for this dns based list |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
75 char *suffix; // blacklist suffix like blackholes.five-ten-sg.com |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
76 char *message; // error message with one or two %s operators for the ip address replacement |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
77 DNSBL(char *n, char *s, char *m); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
78 bool operator==(const DNSBL &rhs); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
79 }; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
80 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
81 class CONTEXT { |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
82 CONTEXTP parent; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
83 char * name; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
84 context_map children; // map child context names to their contexts |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
85 string_set env_to; // this context applies to these envelope recipients |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
86 char * verify_host; // use this smtp host to verify email addresses |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
87 string_map env_from; // map senders to white/black/unknown |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
88 context_map env_from_context; // map senders to a child context |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
89 char * env_from_default; // default value for senders that are not found in the map white/black/unknown/inherit |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
90 bool content_filtering; // |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
91 char * content_suffix; // for sbl url body filtering |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
92 char * content_message; // "" |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
93 string_set content_host_ignore;// hosts to ignore for content sbl checking |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
94 string_set content_tlds; // |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
95 string_set html_tags; // set of valid html tags |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
96 int host_limit; // limit on host names |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
97 char * host_limit_message; // error message for excessive host names |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
98 bool host_random; // pick a random selection of host names rather than error for excessive hosts |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
99 int tag_limit; // limit on bad html tags |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
100 char * tag_limit_message; // error message for excessive bad html tags |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
101 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
102 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
103 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
104 public: |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
105 CONTEXT(CONTEXTP parent_, char *name_); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
106 ~CONTEXT(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
107 CONTEXTP get_parent() {return parent;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
108 bool is_parent(CONTEXTP p); // is p a parent of this? |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
109 char* get_full_name(char *buf, int size); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
110 void add_context(CONTEXTP child) {children[child->name] = child;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
111 bool allow_env_to(char *to) {return (parent) ? parent->cover_env_to(to) : true;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
112 bool cover_env_to(char *to); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
113 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
114 void set_verify(char *host) {verify_host = host;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
115 char* get_verify() {return verify_host;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
116 VERIFYP find_verify(char *to); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
117 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
118 void add_to(char *to) {env_to.insert(to);}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
119 void add_from(char *from, char *status) {env_from[from] = status;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
120 void add_from_context(char *from, CONTEXTP con) {env_from_context[from] = con;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
121 void set_from_default(char *status) {env_from_default = status;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
122 char* find_from(char *from); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
123 CONTEXTP find_context(char *from); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
124 CONTEXTP find_from_context_name(char *name); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
125 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
126 void set_content_filtering(bool filter) {content_filtering = filter;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
127 void set_content_suffix(char *suffix) {content_suffix = suffix;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
128 void set_content_message(char *message) {content_message = message;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
129 void add_ignore(char *host) {content_host_ignore.insert(host);}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
130 void add_tld(char *tld) {content_tlds.insert(tld);}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
131 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
132 void set_host_limit(int limit) {host_limit = limit;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
133 void set_host_message(char *message) {host_limit_message = message;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
134 void set_host_random(bool random) {host_random = random;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
135 void set_tag_limit(int limit) {tag_limit = limit;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
136 void set_tag_message(char *message) {tag_limit_message = message;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
137 void add_tag(char *tag) {html_tags.insert(tag);}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
138 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
139 void add_dnsbl(char *name, DNSBLP dns) {dnsbl_names[name] = dns;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
140 void add_dnsbl(DNSBLP dns) {dnsbl_list.push_back(dns);}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
141 DNSBLP find_dnsbl(char *name); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
142 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
143 bool get_content_filtering() {return content_filtering;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
144 int get_host_limit() {return host_limit;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
145 bool get_host_random() {return host_random;}; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
146 char* get_content_suffix(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
147 char* get_content_message(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
148 string_set& get_content_host_ignore(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
149 string_set& get_content_tlds(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
150 string_set& get_html_tags(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
151 dnsblp_list& get_dnsbl_list(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
152 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
153 bool acceptable_content(recorder &memory, char *&msg); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
154 bool ignore_host(char *host); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
155 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
156 void dump(int level = 0); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
157 }; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
158 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
159 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
160 struct CONFIG { |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
161 // the only mutable stuff once it has been loaded from the config file |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
162 int reference_count; // protected by the global config_mutex |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
163 // all the rest is constant after loading from the config file |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
164 int generation; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
165 time_t load_time; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
166 string_set config_files; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
167 context_list contexts; // owns all the contexts, not just top level contexts |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
168 context_map env_to; // map recipient to a filtering context |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
169 CONTEXTP default_context;// for env_to values that don't have their own specific filtering context |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
170 // the default context is also used for some of the content filtering values |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
171 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
172 CONFIG(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
173 ~CONFIG(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
174 void add_context(CONTEXTP con); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
175 void add_to(char *to, CONTEXTP con); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
176 CONTEXTP find_context(char *to); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
177 void dump(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
178 }; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
179 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
180 extern char *token_black; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
181 extern char *token_content; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
182 extern char *token_context; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
183 extern char *token_dccfrom; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
184 extern char *token_dccto; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
185 extern char *token_default; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
186 extern char *token_dnsbl; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
187 extern char *token_dnsbll; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
188 extern char *token_envfrom; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
189 extern char *token_envto; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
190 extern char *token_filter; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
191 extern char *token_host_limit; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
192 extern char *token_html_limit; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
193 extern char *token_html_tags; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
194 extern char *token_ignore; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
195 extern char *token_include; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
196 extern char *token_inherit; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
197 extern char *token_lbrace; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
198 extern char *token_mailhost; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
199 extern char *token_many; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
200 extern char *token_off; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
201 extern char *token_ok; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
202 extern char *token_ok2; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
203 extern char *token_on; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
204 extern char *token_rbrace; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
205 extern char *token_semi; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
206 extern char *token_soft; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
207 extern char *token_substitute; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
208 extern char *token_tld; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
209 extern char *token_unknown; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
210 extern char *token_white; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
211 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
212 extern char *token_myhostname; |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
213 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
214 extern verify_map verifiers; // map of smtp hosts to verify structures, owns all the verify structures |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
215 extern string_set all_strings; // owns all the strings, only modified by the config loader thread |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
216 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
217 void discard(string_set &s); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
218 char* register_string(string_set &s, char *name); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
219 char* register_string(char *name); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
220 CONFIG *parse_config(char *fn); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
221 bool load_conf(CONFIG &dc, char *fn); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
222 void add_verify_host(char *host); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
223 void* verify_closer(void *arg); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
224 void token_init(); |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
225 |
962a1f8f1d9f
add verify statement to verify addresses with better mx host
carl
parents:
86
diff
changeset
|
226 #endif |