]> git.pld-linux.org Git - packages/postfix.git/blame - postfix-log-proxy-rejects.patch
- rel.2 - monit support for postfix
[packages/postfix.git] / postfix-log-proxy-rejects.patch
CommitLineData
2568882e
JR
1diff -ur postfix-2.4.5/src/smtpd/smtpd.c postfix-2.4.5-proxy/src/smtpd/smtpd.c
2--- postfix-2.4.5/src/smtpd/smtpd.c 2007-09-11 00:27:31.181567626 +0200
3+++ postfix-2.4.5-proxy/src/smtpd/smtpd.c 2007-09-11 00:26:54.177444169 +0200
4@@ -2452,6 +2452,8 @@
5 int out_error;
6 char **cpp;
7 CLEANUP_STAT_DETAIL *detail;
8+ VSTRING *proxy_why = 0;
9+ int proxy_code;
10
11 #ifdef USE_TLS
12 VSTRING *peer_CN;
13@@ -2705,8 +2707,19 @@
642652f5
JR
14 if (state->err == CLEANUP_STAT_OK) {
15 (void) smtpd_proxy_cmd(state, SMTPD_PROX_WANT_ANY, ".");
16 if (state->err == CLEANUP_STAT_OK &&
17- *STR(state->proxy_buffer) != '2')
18+ *STR(state->proxy_buffer) != '2') {
19 state->err = CLEANUP_STAT_CONT;
2568882e
JR
20+ proxy_why = vstring_alloc(10);
21+ vstring_strncpy(proxy_why, STR(state->proxy_buffer), 3);
22+ if (alldig(STR(proxy_why)))
23+ proxy_code = atol(STR(proxy_why));
24+ else
25+ proxy_code = 554;
26+ vstring_strncpy(proxy_why, STR(state->proxy_buffer)+4, 5);
27+ smtpd_check_reject(state, MAIL_ERROR_POLICY, proxy_code, proxy_why,
642652f5 28+ "%s", STR(state->proxy_buffer));
2568882e 29+ vstring_free(proxy_why);
642652f5 30+ }
aa64213c 31 } else if (state->err != CLEANUP_STAT_SIZE) {
642652f5 32 state->err |= CLEANUP_STAT_PROXY;
df1cfd1e 33 detail = cleanup_stat_detail(CLEANUP_STAT_PROXY);
2568882e
JR
34diff -ur postfix-2.4.5/src/smtpd/smtpd_check.c postfix-2.4.5-proxy/src/smtpd/smtpd_check.c
35--- postfix-2.4.5/src/smtpd/smtpd_check.c 2007-09-11 00:27:30.414953649 +0200
36+++ postfix-2.4.5-proxy/src/smtpd/smtpd_check.c 2007-09-11 00:10:33.804822948 +0200
37@@ -378,7 +378,7 @@
38 * mail.
39 */
40 static void PRINTFLIKE(5, 6) defer_if(SMTPD_DEFER *, int, int, const char *, const char *,...);
41-static int PRINTFLIKE(5, 6) smtpd_check_reject(SMTPD_STATE *, int, int, const char *, const char *,...);
42+int PRINTFLIKE(5, 6) smtpd_check_reject(SMTPD_STATE *, int, int, const char *, const char *,...);
43
44 #define DEFER_IF_REJECT2(state, class, code, dsn, fmt, a1, a2) \
45 defer_if(&(state)->defer_if_reject, (class), (code), (dsn), (fmt), (a1), (a2))
46@@ -759,7 +759,7 @@
642652f5
JR
47
48 /* smtpd_check_reject - do the boring things that must be done */
49
50-static int smtpd_check_reject(SMTPD_STATE *state, int error_class,
51+int smtpd_check_reject(SMTPD_STATE *state, int error_class,
df1cfd1e
JR
52 int code, const char *dsn,
53 const char *format,...)
642652f5 54 {
2568882e
JR
55diff -ur postfix-2.4.5/src/smtpd/smtpd_check.h postfix-2.4.5-proxy/src/smtpd/smtpd_check.h
56--- postfix-2.4.5/src/smtpd/smtpd_check.h 2007-09-11 00:27:30.414953649 +0200
57+++ postfix-2.4.5-proxy/src/smtpd/smtpd_check.h 2007-09-11 00:10:33.808156052 +0200
642652f5
JR
58@@ -25,6 +25,7 @@
59 extern char *smtpd_check_data(SMTPD_STATE *);
60 extern char *smtpd_check_eod(SMTPD_STATE *);
61 extern char *smtpd_check_policy(SMTPD_STATE *, char *);
2568882e 62+extern int smtpd_check_reject(SMTPD_STATE *state, int error_class, int code, const char *dsn, const char *format,...);
642652f5
JR
63
64 /* LICENSE
65 /* .ad
This page took 0.106435 seconds and 4 git commands to generate.