163
|
1 /*
|
|
2
|
|
3 Copyright (c) 2007 Carl Byington - 510 Software Group, released under
|
|
4 the GPL version 3 or any later version at your choice available at
|
|
5 http://www.gnu.org/licenses/gpl-3.0.txt
|
|
6
|
|
7 Based on spamass-milter by Georg C. F. Greve <greve@gnu.org>
|
|
8
|
|
9 */
|
|
10
|
|
11 #ifndef _SPAMASS_MILTER_H
|
|
12 #define _SPAMASS_MILTER_H
|
|
13
|
|
14 extern "C" {
|
|
15 #include <libmilter/mfapi.h>
|
|
16 }
|
|
17
|
|
18 #ifdef HAVE_CDEFS_H
|
|
19 #include <sys/cdefs.h>
|
|
20 #endif
|
|
21
|
|
22 #include <list>
|
|
23
|
|
24 using namespace std;
|
|
25
|
|
26 class mlfiPriv;
|
|
27
|
|
28 class SpamAssassin {
|
|
29 public:
|
|
30 SpamAssassin();
|
|
31 ~SpamAssassin();
|
|
32
|
|
33 void mlfi_connect(mlfiPriv *priv_, int ip);
|
|
34 void mlfi_helo(char *helohost);
|
|
35 void mlfi_envfrom(char *from, char *qid);
|
|
36 void mlfi_envrcpt(SMFICTX *ctx, char *envrcpt);
|
|
37 void mlfi_header(char* headerf, char* headerv);
|
|
38 void mlfi_eoh();
|
|
39 void mlfi_body(u_char *bodyp, size_t bodylen);
|
|
40 int mlfi_eom();
|
|
41
|
|
42 private:
|
|
43 void Connect();
|
|
44 void output(const char*buffer, size_t size);
|
|
45 void output(const char*buffer);
|
|
46 void output(string buffer);
|
|
47 void close_output();
|
|
48 void input();
|
|
49 int read_pipe();
|
|
50 void empty_and_close_pipe();
|
|
51 void closeall(int fd);
|
|
52 void warnmacro(char *macro, char *scope);
|
|
53
|
|
54 public:
|
|
55 bool error; // spamc died or cannot work
|
|
56 bool running; // running implies (connected and pid)
|
|
57 bool first_recipient; // have we seen any recipients?
|
|
58
|
|
59 // connection back to main dnsbl priv structure for logging
|
|
60 mlfiPriv *priv;
|
|
61
|
|
62 // strings owned by main dnsbl
|
|
63 char *queueid; // the sendmail queue id for this message
|
|
64 char *envfrom; // envelope from value for this message
|
|
65 char *helo; // client helo value
|
|
66 int ip4; // ip4 address of smtp client
|
|
67
|
|
68 // Process handling variables
|
|
69 pid_t pid;
|
|
70 int pipe_io[2][2];
|
|
71 string spamc_output;
|
|
72 string spamc_input;
|
|
73 };
|
|
74
|
|
75 #endif
|