]>
Commit | Line | Data |
---|---|---|
bbb9de3e AM |
1 | commit 055e2cb463e4e4adf2d9292a50ac274938f9a5ac |
2 | Author: Jeremy Harris <jgh146exb@wizmail.org> | |
3 | Date: Sat Sep 12 15:00:45 2015 +0100 | |
4 | ||
5 | New $callout_address variable to record spamd (etc) address. Bug 1652 | |
6 | ||
7 | diff --git a/src/src/expand.c b/src/src/expand.c | |
8 | index 1bff521..f9849e6 100644 | |
9 | --- a/src/src/expand.c | |
10 | +++ b/src/src/expand.c | |
11 | @@ -462,6 +462,7 @@ static var_entry var_table[] = { | |
12 | { "bounce_return_size_limit", vtype_int, &bounce_return_size_limit }, | |
13 | { "caller_gid", vtype_gid, &real_gid }, | |
14 | { "caller_uid", vtype_uid, &real_uid }, | |
15 | + { "callout_address", vtype_stringptr, &callout_address }, | |
16 | { "compile_date", vtype_stringptr, &version_date }, | |
17 | { "compile_number", vtype_stringptr, &version_cnumber }, | |
18 | { "config_dir", vtype_stringptr, &config_main_directory }, | |
19 | diff --git a/src/src/globals.c b/src/src/globals.c | |
20 | index f3b6791..55a101f 100644 | |
21 | --- a/src/src/globals.c | |
22 | +++ b/src/src/globals.c | |
23 | @@ -478,6 +478,7 @@ int bounce_return_size_limit = 100*1024; | |
24 | uschar *bounce_sender_authentication = NULL; | |
25 | int bsmtp_transaction_linecount = 0; | |
26 | ||
27 | +uschar *callout_address = NULL; | |
28 | int callout_cache_domain_positive_expire = 7*24*60*60; | |
29 | int callout_cache_domain_negative_expire = 3*60*60; | |
30 | int callout_cache_positive_expire = 24*60*60; | |
31 | diff --git a/src/src/globals.h b/src/src/globals.h | |
32 | index 3c69e43..7bfb5aa 100644 | |
33 | --- a/src/src/globals.h | |
34 | +++ b/src/src/globals.h | |
35 | @@ -255,6 +255,7 @@ extern int bounce_return_size_limit; /* Max amount to return */ | |
36 | extern uschar *bounce_sender_authentication; /* AUTH address for bounces */ | |
37 | extern int bsmtp_transaction_linecount; /* Start of last transaction */ | |
38 | ||
39 | +extern uschar *callout_address; /* Address used for a malware/spamd/verify etc. callout */ | |
40 | extern int callout_cache_domain_positive_expire; /* Time for positive domain callout cache records to expire */ | |
41 | extern int callout_cache_domain_negative_expire; /* Time for negative domain callout cache records to expire */ | |
42 | extern int callout_cache_positive_expire; /* Time for positive callout cache records to expire */ | |
43 | diff --git a/src/src/ip.c b/src/src/ip.c | |
44 | index 2d71705..1e3875a 100644 | |
45 | --- a/src/src/ip.c | |
46 | +++ b/src/src/ip.c | |
47 | @@ -237,7 +237,11 @@ if (running_in_test_harness && save_errno == ECONNREFUSED && timeout == 999999) | |
48 | ||
49 | /* Success */ | |
50 | ||
51 | -if (rc >= 0) return 0; | |
52 | +if (rc >= 0) | |
53 | + { | |
54 | + callout_address = string_sprintf("[%s]:%d", address, port); | |
55 | + return 0; | |
56 | + } | |
57 | ||
58 | /* A failure whose error code is "Interrupted system call" is in fact | |
59 | an externally applied timeout if the signal handler has been run. */ | |
60 | @@ -400,6 +404,7 @@ if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) | |
61 | path, strerror(err)); | |
62 | return -1; | |
63 | } | |
64 | +callout_address = string_copy(path); | |
65 | return sock; | |
66 | } | |
67 | ||
68 | diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c | |
69 | index c704a0b..88dde83 100644 | |
70 | --- a/src/src/smtp_out.c | |
71 | +++ b/src/src/smtp_out.c | |
72 | @@ -284,6 +284,8 @@ if (host->port != PORT_NONE) | |
73 | } | |
74 | else host->port = port; /* Set the port actually used */ | |
75 | ||
76 | +callout_address = string_sprintf("[%s]:%d", host->address, port); | |
77 | + | |
78 | HDEBUG(D_transport|D_acl|D_v) | |
79 | { | |
80 | uschar * s = US" "; | |
81 | @@ -291,8 +293,7 @@ HDEBUG(D_transport|D_acl|D_v) | |
82 | #ifdef EXPERIMENTAL_SOCKS | |
83 | if (ob->socks_proxy) s = string_sprintf("%svia proxy ", s); | |
84 | #endif | |
85 | - debug_printf("Connecting to %s [%s]:%d%s... ", | |
86 | - host->name, host->address, port, s); | |
87 | + debug_printf("Connecting to %s %s%s... ", host->name, callout_address, s); | |
88 | } | |
89 | ||
90 | /* Create and connect the socket */ | |
91 |