annotate src/spamass.h @ 331:9800776436b9

allow dkim whitelisting to override uribl hosts in the mail body
author Carl Byington <carl@five-ten-sg.com>
date Mon, 19 Dec 2016 15:32:32 -0800
parents 82886d4dd71f
children 78eedbbce636
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
1 /*
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
2
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
4 the GPL version 3 or any later version at your choice available at
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
5 http://www.gnu.org/licenses/gpl-3.0.txt
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
6
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
7 Based on spamass-milter by Georg C. F. Greve <greve@gnu.org>
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
8
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
9 */
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
10
177
a4d313c2460b start embedded dcc filtering
carl
parents: 168
diff changeset
11 #ifndef _SPAMASS_H
a4d313c2460b start embedded dcc filtering
carl
parents: 168
diff changeset
12 #define _SPAMASS_H
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
13
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
14 extern "C" {
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
15 #include <libmilter/mfapi.h>
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
16 }
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
17
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
18 #ifdef HAVE_CDEFS_H
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
19 #include <sys/cdefs.h>
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
20 #endif
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
21
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
22 #include <list>
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
23
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
24 extern const char *spamc;
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
25 extern const char *spamc_empty;
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
26 using namespace std;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
27
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
28 class mlfiPriv;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
29
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
30 class SpamAssassin {
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
31 public:
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
32 SpamAssassin(mlfiPriv *priv_, int ip, const char *helo_, const char *from, const char *qid);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
33 ~SpamAssassin();
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
34
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
35 void mlfi_envrcpt(SMFICTX *ctx, const char *envrcpt);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
36 void mlfi_header(const char* headerf, const char* headerv);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
37 void mlfi_eoh();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
38 void mlfi_body(const u_char *bodyp, size_t bodylen);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
39 int mlfi_eom();
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
40
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
41 private:
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
42 void Connect();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
43 void output(const char *buffer, size_t size);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
44 void output(const char *buffer);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
45 void output(string buffer);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
46 void close_output();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
47 void input();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
48 int read_pipe();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
49 void empty_and_close_pipe();
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
50 void closeall(int fd);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
51 const char *getorwarnmacro(SMFICTX *ctx, const char *macro, const char *def, const char *scope);
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
52 void warnmacro(const char *macro, const char *scope);
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
53
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
54 public:
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
55 bool error; // spamc died or cannot work
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
56 bool running; // running implies (connected and pid)
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
57 bool first_recipient; // have we not seen any recipients?
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
58
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
59 // connection back to main dnsbl priv structure for logging
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
60 mlfiPriv *priv;
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
61 int ip4; // ip4 address of smtp client
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
62
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
63 // strings owned by main dnsbl
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
64 const char *helo; // client helo value
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
65 const char *envfrom; // envelope from value for this message
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
66 const char *queueid; // the sendmail queue id for this message
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
67
214
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
68 // Process handling variables
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
69 pid_t pid;
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
70 int pipe_io[2][2];
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
71 string spamc_output;
82886d4dd71f Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents: 177
diff changeset
72 string spamc_input;
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
73 };
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
74
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
75 #endif