Rev 90 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
70 | magnus | 1 | Description: Changes needed because Exim now exports only the symbols |
2 | that are part of the official API. |
||
3 | Author: Magnus Holmgren <holmgren@debian.org> |
||
4 | Bug-Debian: http://bugs.debian.org/420443 |
||
5 | Bug-Debian: http://bugs.debian.org/420555 |
||
6 | Bug-Debian: http://bugs.debian.org/420736 |
||
7 | |||
90 | magnus | 8 | --- a/sa-exim.c |
9 | +++ b/sa-exim.c |
||
10 | @@ -29,10 +29,7 @@ http://lists.merlins.org/lists/listinfo/ |
||
70 | magnus | 11 | #include "sa-exim.h" |
12 | |||
13 | /* Exim includes */ |
||
14 | -#include "local_scan.h" |
||
15 | -extern FILE *smtp_out; /* Exim's incoming SMTP output file */ |
||
16 | -extern int body_linecount; /* Line count in body */ |
||
17 | -extern uschar *primary_hostname; |
||
18 | +#include <local_scan.h> |
||
19 | |||
20 | #ifdef DLOPEN_LOCAL_SCAN |
||
21 | |||
90 | magnus | 22 | @@ -602,6 +599,10 @@ int local_scan(volatile int fd, uschar * |
70 | magnus | 23 | /* Do not put a %s in there, or you'll segfault */ |
24 | static char *SAmsgerror="Temporary local error while processing message, please contact postmaster"; |
||
25 | |||
26 | + /* This needs to be retrieved through expand_string in order |
||
27 | + not to violate the API. */ |
||
90 | magnus | 28 | + uschar *primary_hostname=expand_string("$primary_hostname"); |
70 | magnus | 29 | + |
30 | /* New values we read from spamassassin */ |
||
31 | char *xspamstatus=NULL; |
||
32 | char *xspamflag=NULL; |
||
91 | magnus | 33 | @@ -1229,18 +1230,20 @@ restart: |
34 | } |
||
35 | } |
||
36 | |||
37 | + |
||
38 | if (SAEximDebug > 1) |
||
70 | magnus | 39 | { |
91 | magnus | 40 | log_write(0, LOG_MAIN, "SA: Debug2: body_linecount before SA: %d", body_linecount); |
41 | } |
||
42 | |||
43 | /* update global variable $body_linecount to reflect the new body size*/ |
||
44 | - body_linecount = (line - 1); |
||
45 | + if (body_linecount > 0) body_linecount = (line - 1); // Not updating if zero, indicating spool_wireformat |
||
46 | |||
47 | if (SAEximDebug > 1) |
||
48 | { |
||
70 | magnus | 49 | log_write(0, LOG_MAIN, "SA: Debug2: body_linecount after SA: %d", body_linecount); |
50 | } |
||
90 | magnus | 51 | + |
70 | magnus | 52 | } |
53 | |||
54 | fclose((FILE *)readfh); |
||
91 | magnus | 55 | @@ -1331,6 +1334,9 @@ restart: |
70 | magnus | 56 | |
57 | if (dorej && doteergrube) |
||
58 | { |
||
59 | + char *teergrubewaitstr; |
||
60 | + teergrubewaitstr=string_sprintf(SAmsgteergrubewait, spamstatus); |
||
61 | + |
||
62 | /* By default, we'll only save temp bounces by message ID so |
||
63 | * that when the same message is submitted several times, we |
||
64 | * overwrite the same file on disk and not create a brand new |
||
91 | magnus | 65 | @@ -1353,20 +1359,8 @@ restart: |
70 | magnus | 66 | |
67 | for (i=0;i<SAteergrubetime/10;i++) |
||
68 | { |
||
69 | - char *str; |
||
70 | - |
||
71 | - /* Unfortunately, we can't use exim's smtp_printf because it |
||
72 | - * doesn't return an error code if the write gets an EPIPE. |
||
73 | - * So, we write ourselves, but this won't work if you have a |
||
74 | - * TLS connection opened (that said, if you are teergrubing |
||
75 | - * a TLS connection, it's probably a relay host, not a |
||
76 | - * spammer, and in this case you should not teergrube a |
||
77 | - * friendly relay, so basically we should be ok). |
||
78 | - * If you do teergrube an SSL connection with the current |
||
79 | - * code, you will break it, but that's acceptable */ |
||
80 | - str=string_sprintf(string_sprintf("451- %s\r\n",SAmsgteergrubewait), spamstatus); |
||
81 | - fprintf(smtp_out, str); |
||
82 | - ret=fflush(smtp_out); |
||
83 | + smtp_printf("451-%s\r\n", teergrubewaitstr); |
||
84 | + ret=smtp_fflush(); |
||
85 | if (ret != 0) |
||
86 | { |
||
87 | 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); |