29,8 → 29,10 |
#include "sa-exim.h" |
|
/* Exim includes */ |
#include <local_scan.h> |
//extern int body_linecount; /* Line count in body */ |
#include "local_scan.h" |
extern FILE *smtp_out; /* Exim's incoming SMTP output file */ |
extern int body_linecount; /* Line count in body */ |
extern uschar *primary_hostname; |
|
#ifdef DLOPEN_LOCAL_SCAN |
|
602,12 → 604,6 |
/* Do not put a %s in there, or you'll segfault */ |
static char *SAmsgerror="Temporary local error while processing message, please contact postmaster"; |
|
/* This needs to be retrieved through expand_string in order |
not to violate the API. */ |
static uschar *primary_hostname; |
if (!primary_hostname) |
primary_hostname = expand_string("$primary_hostname"); |
|
/* New values we read from spamassassin */ |
char *xspamstatus=NULL; |
char *xspamflag=NULL; |
1261,19 → 1257,18 |
} |
} |
|
/* if (SAEximDebug > 1) |
if (SAEximDebug > 1) |
{ |
log_write(0, LOG_MAIN, "SA: Debug2: body_linecount before SA: %d", body_linecount); |
} |
*/ |
|
/* update global variable $body_linecount to reflect the new body size*/ |
/* body_linecount = (line - 1); |
body_linecount = (line - 1); |
|
if (SAEximDebug > 1) |
{ |
log_write(0, LOG_MAIN, "SA: Debug2: body_linecount after SA: %d", body_linecount); |
} |
*/ |
} |
|
fclose((FILE *)readfh); |
1364,9 → 1359,6 |
|
if (dorej && doteergrube) |
{ |
char *teergrubewaitstr; |
teergrubewaitstr=string_sprintf(SAmsgteergrubewait, spamstatus); |
|
/* By default, we'll only save temp bounces by message ID so |
* that when the same message is submitted several times, we |
* overwrite the same file on disk and not create a brand new |
1389,8 → 1381,20 |
|
for (i=0;i<SAteergrubetime/10;i++) |
{ |
smtp_printf("451-%s\r\n", teergrubewaitstr); |
ret=smtp_fflush(); |
char *str; |
|
/* Unfortunately, we can't use exim's smtp_printf because it |
* doesn't return an error code if the write gets an EPIPE. |
* So, we write ourselves, but this won't work if you have a |
* TLS connection opened (that said, if you are teergrubing |
* a TLS connection, it's probably a relay host, not a |
* spammer, and in this case you should not teergrube a |
* friendly relay, so basically we should be ok). |
* If you do teergrube an SSL connection with the current |
* code, you will break it, but that's acceptable */ |
str=string_sprintf(string_sprintf("451- %s\r\n",SAmsgteergrubewait), spamstatus); |
fprintf(smtp_out, str); |
ret=fflush(smtp_out); |
if (ret != 0) |
{ |
log_write(0, LOG_MAIN | LOG_REJECT, "SA: Action: teergrubed sender for %d secs until it closed the connection: %s (scanned in %d/%d secs | Message-Id: %s). %s", i*10, spamstatus, scantime, fulltime, safemesgid, mailinfo); |