annotate src/spamass.h @ 449:d4275f26241c stable-6-0-69

fix spf mx:domain.tld token parsing
author Carl Byington <carl@five-ten-sg.com>
date Tue, 10 Apr 2018 12:56:07 -0700
parents 78eedbbce636
children 5209e92b4885
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>
445
78eedbbce636 round spamassassin scores; check >= rather than >
Carl Byington <carl@five-ten-sg.com>
parents: 214
diff changeset
23 #include <math.h>
163
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
27 using namespace std;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
28
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
29 class mlfiPriv;
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
30
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
31 class SpamAssassin {
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
41
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
54
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
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
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
74 };
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
75
97d7da45fe2a spamassassin changes
carl
parents:
diff changeset
76 #endif