comparison src/spamass.cpp.in @ 177:a4d313c2460b

start embedded dcc filtering
author carl
date Sun, 30 Sep 2007 10:27:14 -0700
parents bd33eaccfed8
children 92a5c866bdfa
comparison
equal deleted inserted replaced
176:4ec928b24bab 177:a4d313c2460b
6 6
7 Based on spamass-milter by Georg C. F. Greve <greve@gnu.org> 7 Based on spamass-milter by Georg C. F. Greve <greve@gnu.org>
8 8
9 */ 9 */
10 10
11 #include "config.h" 11 #include "includes.h"
12 #include "dnsbl.h"
13 #include <errno.h> 12 #include <errno.h>
14 #include <fcntl.h> 13 #include <fcntl.h>
15 #include <poll.h> 14 #include <poll.h>
16 #include <signal.h> 15 #include <signal.h>
17 #include <string> 16 #include <string>
22 21
23 static const char Id[] = "$Id$"; 22 static const char Id[] = "$Id$";
24 23
25 char *spamc = "@SPAMC@"; 24 char *spamc = "@SPAMC@";
26 char *spamc_empty = ""; 25 char *spamc_empty = "";
27 bool warnedmacro = false; /* have we logged that we couldn't fetch a macro? */ 26 static bool warnedmacro = false; // have we logged that we couldn't fetch a macro?
28 const int maxlen = 1000; // used for snprintf buffers 27 const int maxlen = 1000; // used for snprintf buffers
29 28
30 29
31 SpamAssassin::SpamAssassin(mlfiPriv *priv_, int ip, char *helo_, char *from, char *qid) 30 SpamAssassin::SpamAssassin(mlfiPriv *priv_, int ip, char *helo_, char *from, char *qid)
32 { 31 {
33 error = false; 32 error = false;
68 67
69 68
70 void SpamAssassin::mlfi_envrcpt(SMFICTX *ctx, char *envrcpt) 69 void SpamAssassin::mlfi_envrcpt(SMFICTX *ctx, char *envrcpt)
71 { 70 {
72 if (first_recipient) { 71 if (first_recipient) {
72 first_recipient = false;
73 /* Send the envelope headers as X-Envelope-From: and 73 /* Send the envelope headers as X-Envelope-From: and
74 X-Envelope-To: so that SpamAssassin can use them in its 74 X-Envelope-To: so that SpamAssassin can use them in its
75 whitelist checks. Also forge as complete a dummy 75 whitelist checks. Also forge as complete a dummy
76 Received: header as possible because SA gets a lot of 76 Received: header as possible because SA gets a lot of
77 info from it. 77 info from it.
120 macro_b + "\r\n"); 120 macro_b + "\r\n");
121 121
122 output(string("X-Envelope-From: ") + envfrom + "\r\n"); 122 output(string("X-Envelope-From: ") + envfrom + "\r\n");
123 } 123 }
124 output(string("X-Envelope-To: ") + envrcpt + "\r\n"); 124 output(string("X-Envelope-To: ") + envrcpt + "\r\n");
125 first_recipient = false;
126 } 125 }
127 126
128 127
129 void SpamAssassin::mlfi_header(char* headerf, char* headerv) 128 void SpamAssassin::mlfi_header(char* headerf, char* headerv)
130 { 129 {
131 if (!running) Connect(); 130 if (!running) Connect();
132 output(spamc_input); 131 if (running) {
132 output(spamc_input);
133 spamc_input.empty();
134 }
135
133 output(headerf); 136 output(headerf);
134 output(": "); 137 output(": ");
135 output(headerv); 138 output(headerv);
136 output("\r\n"); 139 output("\r\n");
137 spamc_input.empty();
138 } 140 }
139 141
140 142
141 void SpamAssassin::mlfi_eoh() 143 void SpamAssassin::mlfi_eoh()
142 { 144 {