comparison src/context.h @ 136:f4746d8a12a3

add smtp auth rate limits
author carl
date Tue, 26 Sep 2006 13:59:14 -0700
parents d9d2f8699621
children 4028de9b46dd
comparison
equal deleted inserted replaced
135:8e813497582e 136:f4746d8a12a3
26 typedef map<char *, DNSBLP, ltstr> dnsblp_map; 26 typedef map<char *, DNSBLP, ltstr> dnsblp_map;
27 typedef CONTEXT * CONTEXTP; 27 typedef CONTEXT * CONTEXTP;
28 typedef list<CONTEXTP> context_list; 28 typedef list<CONTEXTP> context_list;
29 typedef map<char *, CONTEXTP, ltstr> context_map; 29 typedef map<char *, CONTEXTP, ltstr> context_map;
30 typedef map<char *, int, ltstr> ns_mapper; 30 typedef map<char *, int, ltstr> ns_mapper;
31 typedef map<char *, int, ltstr> rcpt_rates;
31 typedef map<char *, VERIFYP, ltstr> verify_map; 32 typedef map<char *, VERIFYP, ltstr> verify_map;
32 33
33 class SMTP { 34 class SMTP {
34 static const int maxlen = 1000; 35 static const int maxlen = 1000;
35 int fd; 36 int fd;
109 bool host_random; // pick a random selection of host names rather than error for excessive hosts 110 bool host_random; // pick a random selection of host names rather than error for excessive hosts
110 int tag_limit; // limit on bad html tags 111 int tag_limit; // limit on bad html tags
111 char * tag_limit_message; // error message for excessive bad html tags 112 char * tag_limit_message; // error message for excessive bad html tags
112 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children 113 dnsblp_map dnsbl_names; // name to dnsbl mapping for lists that are available in this context and children
113 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context 114 dnsblp_list dnsbl_list; // list of dnsbls to be used in this context
115 rcpt_rates rcpt_per_hour; // per user limits on number of recipients per hour
116
114 117
115 public: 118 public:
116 CONTEXT(CONTEXTP parent_, char *name_); 119 CONTEXT(CONTEXTP parent_, char *name_);
117 ~CONTEXT(); 120 ~CONTEXT();
118 CONTEXTP get_parent() {return parent;}; 121 CONTEXTP get_parent() {return parent;};
123 bool cover_env_to(char *to); 126 bool cover_env_to(char *to);
124 127
125 void set_verify(char *host) {verify_host = host;}; 128 void set_verify(char *host) {verify_host = host;};
126 char* get_verify() {return verify_host;}; 129 char* get_verify() {return verify_host;};
127 VERIFYP find_verify(char *to); 130 VERIFYP find_verify(char *to);
131
132 void add_rate(char *user, int limit) {rcpt_per_hour[user] = limit;};
133 int find_rate(char *user);
128 134
129 void add_to(char *to) {env_to.insert(to);}; 135 void add_to(char *to) {env_to.insert(to);};
130 void add_from(char *from, char *status) {env_from[from] = status;}; 136 void add_from(char *from, char *status) {env_from[from] = status;};
131 void add_from_context(char *from, CONTEXTP con) {env_from_context[from] = con;}; 137 void add_from_context(char *from, CONTEXTP con) {env_from_context[from] = con;};
132 void set_from_default(char *status) {env_from_default = status;}; 138 void set_from_default(char *status) {env_from_default = status;};
190 ~CONFIG(); 196 ~CONFIG();
191 void add_context(CONTEXTP con); 197 void add_context(CONTEXTP con);
192 void add_to(char *to, CONTEXTP con); 198 void add_to(char *to, CONTEXTP con);
193 CONTEXTP find_context(char *to); 199 CONTEXTP find_context(char *to);
194 void dump(); 200 void dump();
201 };
202
203 struct RATELIMIT {
204
195 }; 205 };
196 206
197 extern char *token_black; 207 extern char *token_black;
198 extern char *token_cctld; 208 extern char *token_cctld;
199 extern char *token_content; 209 extern char *token_content;
217 extern char *token_many; 227 extern char *token_many;
218 extern char *token_off; 228 extern char *token_off;
219 extern char *token_ok2; 229 extern char *token_ok2;
220 extern char *token_ok; 230 extern char *token_ok;
221 extern char *token_on; 231 extern char *token_on;
232 extern char *token_rate;
222 extern char *token_rbrace; 233 extern char *token_rbrace;
223 extern char *token_semi; 234 extern char *token_semi;
224 extern char *token_soft; 235 extern char *token_soft;
225 extern char *token_substitute; 236 extern char *token_substitute;
226 extern char *token_tld; 237 extern char *token_tld;