Mercurial > dnsbl
annotate src/spamass.h @ 461:c22fc705c597
Added tag stable-6-0-74 for changeset ad05c61d6372
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 24 Dec 2018 09:41:04 -0800 |
parents | 78eedbbce636 |
children | 5209e92b4885 |
rev | line source |
---|---|
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 | |
177 | 11 #ifndef _SPAMASS_H |
12 #define _SPAMASS_H | |
163 | 13 |
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 | 16 } |
17 | |
18 #ifdef HAVE_CDEFS_H | |
19 #include <sys/cdefs.h> | |
20 #endif | |
21 | |
22 #include <list> | |
445
78eedbbce636
round spamassassin scores; check >= rather than >
Carl Byington <carl@five-ten-sg.com>
parents:
214
diff
changeset
|
23 #include <math.h> |
163 | 24 |
214
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; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
26 extern const char *spamc_empty; |
163 | 27 using namespace std; |
28 | |
29 class mlfiPriv; | |
30 | |
31 class SpamAssassin { | |
32 public: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
33 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
|
34 ~SpamAssassin(); |
163 | 35 |
214
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_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
|
37 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
|
38 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
|
39 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
|
40 int mlfi_eom(); |
163 | 41 |
42 private: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
43 void Connect(); |
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, 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
|
45 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
|
46 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
|
47 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
|
48 void input(); |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 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
|
53 void warnmacro(const char *macro, const char *scope); |
163 | 54 |
55 public: | |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
56 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
|
57 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
|
58 bool first_recipient; // have we not seen any recipients? |
163 | 59 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
60 // 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
|
61 mlfiPriv *priv; |
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
62 int ip4; // ip4 address of smtp client |
163 | 63 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
64 // 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
|
65 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
|
66 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
|
67 const char *queueid; // the sendmail queue id for this message |
163 | 68 |
214
82886d4dd71f
Fixes to compile on Fedora 9 and for const correctness.
Carl Byington <carl@five-ten-sg.com>
parents:
177
diff
changeset
|
69 // 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
|
70 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
|
71 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
|
72 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
|
73 string spamc_input; |
163 | 74 }; |
75 | |
76 #endif |