annotate src/dnsbl.h @ 192:8f4a9a37d4d9

delay autowhitelisting to avoid out of office reply bots
author carl
date Sun, 11 Nov 2007 12:49:25 -0800
parents 004b855c6c1f
children 82886d4dd71f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
143
ecb40aa3eaa5 require two periods for ip addresses
carl
parents: 136
diff changeset
1 /*
ecb40aa3eaa5 require two periods for ip addresses
carl
parents: 136
diff changeset
2
152
c7fc218686f5 gpl3, block mail to recipients that cannot reply
carl
parents: 143
diff changeset
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under
c7fc218686f5 gpl3, block mail to recipients that cannot reply
carl
parents: 143
diff changeset
4 the GPL version 3 or any later version at your choice available at
c7fc218686f5 gpl3, block mail to recipients that cannot reply
carl
parents: 143
diff changeset
5 http://www.gnu.org/licenses/gpl-3.0.txt
143
ecb40aa3eaa5 require two periods for ip addresses
carl
parents: 136
diff changeset
6
ecb40aa3eaa5 require two periods for ip addresses
carl
parents: 136
diff changeset
7 */
ecb40aa3eaa5 require two periods for ip addresses
carl
parents: 136
diff changeset
8
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
9 #ifndef dnsbl_include
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
10 #define dnsbl_include
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
11
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
12 #include "context.h"
163
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
13 #include "spamass.h"
178
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
14 #include "dccifd.h"
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
15
86
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
16 extern int debug_syslog;
180
7a722f482bfb embedded dcc filtering
carl
parents: 178
diff changeset
17 #define dccbulk 1000
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
18
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
19 class recorder;
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
20 class url_scanner;
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
21
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
22 ////////////////////////////////////////////////
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
23 // mail filter private data, held for us by sendmail
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
24 //
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
25 struct mlfiPriv
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
26 {
187
f0eda59e8afd fix null pointer dereference from missing HELO command
carl
parents: 180
diff changeset
27 // callback specific data
f0eda59e8afd fix null pointer dereference from missing HELO command
carl
parents: 180
diff changeset
28 SMFICTX *ctx; // updated everytime we fetch this priv pointer from the ctx
190
004b855c6c1f fix null pointer dereference from missing HELO command
carl
parents: 187
diff changeset
29 bool eom; // are we in eom function, so progress function can be called?
86
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
30 // connection specific data
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
31 CONFIG *pc; // global filtering configuration
177
a4d313c2460b start embedded dcc filtering
carl
parents: 168
diff changeset
32 int fd; // to talk to dns resolver process
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
33 bool err; // did we get any errors on the resolver socket?
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
34 int ip; // ip4 address of the smtp client
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
35 char *helo; // helo from client
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
36 map<DNSBLP, bool> checked; // map of dnsblp to result of (ip listed on that dnsbl)
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
37 // message specific data
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
38 char *mailaddr; // envelope from value
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
39 char *queueid; // sendmail queue id
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
40 char *authenticated; // client authenticated? if so, suppress all dnsbl checks, but check rate limits
168
6bac960af6b4 add generic reverse dns filtering regex
carl
parents: 167
diff changeset
41 char *client_name; // fully qualified host name of the smtp client
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
42 bool have_whites; // have at least one whitelisted recipient? need to accept content and remove all non-whitelisted recipients if it fails
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
43 bool only_whites; // every recipient is whitelisted?
178
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
44 bool want_spamassassin; // at least one non-whitelisted recipient has a non zero spamassassin limit
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
45 bool want_dccgrey; // at least one non-whitelisted recipient wants dcc greylisting
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
46 bool want_dccbulk; // at least one non-whitelisted recipient wants dcc bulk filtering
192
8f4a9a37d4d9 delay autowhitelisting to avoid out of office reply bots
carl
parents: 190
diff changeset
47 bool is_bulk_precedence; // have precedence:bulk header to prevent autowhitelisting
8f4a9a37d4d9 delay autowhitelisting to avoid out of office reply bots
carl
parents: 190
diff changeset
48 delay_whitelist delayer; // to remember autowhitelisting until we see headers
178
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
49 CONTEXT *content_context; // first non-whitelisted recipient with a content filtering context
167
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
50 context_map env_to; // map each non-whitelisted recipient to their filtering context
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
51 recorder *memory; // memory for the content scanner
9b129ed78d7d actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents: 163
diff changeset
52 url_scanner *scanner; // object to handle body scanning
163
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
53 char *content_suffix; // for url body filtering based on ip addresses of hostnames in the body
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
54 char *content_message; // ""
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
55 char *uribl_suffix; // for uribl body filtering based on hostnames in the body
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
56 char *uribl_message; // ""
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
57 string_set *content_host_ignore; // ""
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
58 SpamAssassin *assassin;
178
d6531c702be3 embedded dcc filtering
carl
parents: 177
diff changeset
59 DccInterface *dccifd;
76
81f1e400e8ab start coding on new config syntax
carl
parents: 74
diff changeset
60
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
61
86
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
62 mlfiPriv();
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
63 ~mlfiPriv();
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
64 void reset(bool final = false); // for a new message
86
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
65 void get_fd();
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
66 void return_fd();
177
a4d313c2460b start embedded dcc filtering
carl
parents: 168
diff changeset
67 size_t my_read(char *buf, size_t len);
a4d313c2460b start embedded dcc filtering
carl
parents: 168
diff changeset
68 size_t my_write(const char *buf, size_t len);
86
c1280cd3e248 add multiple debug syslog levels, remove duplicate dnsbl definitions
carl
parents: 76
diff changeset
69 void need_content_filter(char *rcpt, CONTEXT &con);
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
70 };
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
71
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
72 void my_syslog(mlfiPriv *priv, char *text);
163
97d7da45fe2a spamassassin changes
carl
parents: 152
diff changeset
73 void my_syslog(mlfiPriv *priv, string text);
119
d9d2f8699621 uribl patch from Jeff Evans <jeffe@tricab.com>
carl
parents: 86
diff changeset
74 void my_syslog(char *text);
74
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
75
b7449114ebb0 start coding on new config syntax
carl
parents:
diff changeset
76 #endif