Go to most recent revision | Details | 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 | |||
8 | --- sa-exim-4.2.1.orig/sa-exim.c |
||
9 | +++ sa-exim-4.2.1/sa-exim.c |
||
10 | @@ -29,10 +29,8 @@ http://lists.merlins.org/lists/listinfo/ |
||
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 | +//extern int body_linecount; /* Line count in body */ |
||
20 | |||
21 | #ifdef DLOPEN_LOCAL_SCAN |
||
22 | |||
23 | @@ -602,6 +602,15 @@ int local_scan(volatile int fd, uschar * |
||
24 | /* Do not put a %s in there, or you'll segfault */ |
||
25 | static char *SAmsgerror="Temporary local error while processing message, please contact postmaster"; |
||
26 | |||
27 | + /* This needs to be retrieved through expand_string in order |
||
28 | + not to violate the API. */ |
||
29 | + static uschar *primary_hostname; |
||
30 | + if (!primary_hostname) { |
||
31 | + store_pool = POOL_PERM; |
||
32 | + primary_hostname = expand_string("$primary_hostname"); |
||
33 | + store_pool = POOL_MAIN; |
||
34 | + } |
||
35 | + |
||
36 | /* New values we read from spamassassin */ |
||
37 | char *xspamstatus=NULL; |
||
38 | char *xspamflag=NULL; |
||
39 | @@ -1229,18 +1268,19 @@ restart: |
||
40 | } |
||
41 | } |
||
42 | |||
43 | - if (SAEximDebug > 1) |
||
44 | +/* if (SAEximDebug > 1) |
||
45 | { |
||
46 | log_write(0, LOG_MAIN, "SA: Debug2: body_linecount before SA: %d", body_linecount); |
||
47 | } |
||
48 | - |
||
49 | +*/ |
||
50 | /* update global variable $body_linecount to reflect the new body size*/ |
||
51 | - body_linecount = (line - 1); |
||
52 | +/* body_linecount = (line - 1); |
||
53 | |||
54 | if (SAEximDebug > 1) |
||
55 | { |
||
56 | log_write(0, LOG_MAIN, "SA: Debug2: body_linecount after SA: %d", body_linecount); |
||
57 | } |
||
58 | +*/ |
||
59 | } |
||
60 | |||
61 | fclose((FILE *)readfh); |
||
62 | @@ -1331,6 +1371,9 @@ restart: |
||
63 | |||
64 | if (dorej && doteergrube) |
||
65 | { |
||
66 | + char *teergrubewaitstr; |
||
67 | + teergrubewaitstr=string_sprintf(SAmsgteergrubewait, spamstatus); |
||
68 | + |
||
69 | /* By default, we'll only save temp bounces by message ID so |
||
70 | * that when the same message is submitted several times, we |
||
71 | * overwrite the same file on disk and not create a brand new |
||
72 | @@ -1353,20 +1396,8 @@ restart: |
||
73 | |||
74 | for (i=0;i<SAteergrubetime/10;i++) |
||
75 | { |
||
76 | - char *str; |
||
77 | - |
||
78 | - /* Unfortunately, we can't use exim's smtp_printf because it |
||
79 | - * doesn't return an error code if the write gets an EPIPE. |
||
80 | - * So, we write ourselves, but this won't work if you have a |
||
81 | - * TLS connection opened (that said, if you are teergrubing |
||
82 | - * a TLS connection, it's probably a relay host, not a |
||
83 | - * spammer, and in this case you should not teergrube a |
||
84 | - * friendly relay, so basically we should be ok). |
||
85 | - * If you do teergrube an SSL connection with the current |
||
86 | - * code, you will break it, but that's acceptable */ |
||
87 | - str=string_sprintf(string_sprintf("451- %s\r\n",SAmsgteergrubewait), spamstatus); |
||
88 | - fprintf(smtp_out, str); |
||
89 | - ret=fflush(smtp_out); |
||
90 | + smtp_printf("451-%s\r\n", teergrubewaitstr); |
||
91 | + ret=smtp_fflush(); |
||
92 | if (ret != 0) |
||
93 | { |
||
94 | 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); |