Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 70 | Go to most recent revision | 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;
90 magnus 33
@@ -1241,6 +1242,7 @@ restart:
70 magnus 34
        {
35
            log_write(0, LOG_MAIN, "SA: Debug2: body_linecount after SA: %d", body_linecount);
36
        }
90 magnus 37
+
70 magnus 38
     }
39
 
40
     fclose((FILE *)readfh);
90 magnus 41
@@ -1331,6 +1333,9 @@ restart:
70 magnus 42
 
43
        if (dorej && doteergrube)
44
        {
45
+           char *teergrubewaitstr;
46
+           teergrubewaitstr=string_sprintf(SAmsgteergrubewait, spamstatus);
47
+
48
            /* By default, we'll only save temp bounces by message ID so
49
             * that when the same message is submitted several times, we
50
             * overwrite the same file on disk and not create a brand new
90 magnus 51
@@ -1353,20 +1358,8 @@ restart:
70 magnus 52
 
53
            for (i=0;i<SAteergrubetime/10;i++)
54
            {
55
-               char *str;
56
-               
57
-               /* Unfortunately, we can't use exim's smtp_printf because it
58
-                * doesn't return an error code if the write gets an EPIPE.
59
-                * So, we write ourselves, but this won't work if you have a
60
-                * TLS connection opened (that said, if you are teergrubing
61
-                * a TLS connection, it's probably a relay host, not a
62
-                * spammer, and in this case you should not teergrube a
63
-                * friendly relay, so basically we should be ok).
64
-                * If you do teergrube an SSL connection with the current
65
-                * code, you will break it, but that's acceptable */
66
-               str=string_sprintf(string_sprintf("451- %s\r\n",SAmsgteergrubewait), spamstatus);
67
-               fprintf(smtp_out, str);
68
-               ret=fflush(smtp_out);
69
+               smtp_printf("451-%s\r\n", teergrubewaitstr);
70
+               ret=smtp_fflush();
71
                if (ret != 0)
72
                {
73
                    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);