|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Wietse Venema (wietse
porcupine.org)
Date: Sat Dec 05 2009 - 19:28:14 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Dec 04, 2009 at 08:54:01PM +0100, Stefan F??rster wrote:
> Now, about logging - I'd be really grateful if the existing logging
> functionality could be extended in a way so that the pre-queue
> content filter's response is logged.
>
> I know that it is actually the content filter's job to log what it did
> during an ESMTP transaction, but I think if Postfix logged the
> filter's response, correlating logs would be much easier.
Like this?
Dec 5 20:15:25 server postfix/smtpd[16712]: proxy-accept:
END-OF-MESSAGE: 250 2.0.0 Ok: queued as 91BE3547AFE;
from=<sender
example.com> to=<recipient
example.com> proto=ESMTP
helo=<client.example.com>
(with the same form for proxy-reject at END-OF-MESSAGE; the format
of the reject message would be consistent with other Postfix reject
messages.)
Wietse
diff --exclude=man --exclude=html --exclude=README_FILES --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.7-20091115/src/smtpd/smtpd.c ./smtpd.c
*** /var/tmp/postfix-2.7-20091115/src/smtpd/smtpd.c Sun Nov 15 10:34:24 2009
--- ./smtpd.c Sat Dec 5 20:16:33 2009
***************
*** 1353,1358 ****
--- 1353,1379 ----
#endif
+ /* smtpd_whatsup - gather available evidence for logging */
+
+ static const char *smtpd_whatsup(SMTPD_STATE *state)
+ {
+ static VSTRING *buf = 0;
+
+ if (buf == 0)
+ buf = vstring_alloc(100);
+ else
+ VSTRING_RESET(buf);
+ if (state->sender)
+ vstring_sprintf_append(buf, " from=<%s>", state->sender);
+ if (state->recipient)
+ vstring_sprintf_append(buf, " to=<%s>", state->recipient);
+ if (state->protocol)
+ vstring_sprintf_append(buf, " proto=%s", state->protocol);
+ if (state->helo_name)
+ vstring_sprintf_append(buf, " helo=<%s>", state->helo_name);
+ return (STR(buf));
+ }
+
/* collapse_args - put arguments together again */
static void collapse_args(int argc, SMTPD_TOKEN *argv)
***************
*** 3097,3102 ****
--- 3103,3116 ----
}
/*
+ * By popular command: the proxy's end-of-data reply.
+ */
+ if (proxy)
+ msg_info("proxy-%s: %s: %s;%s",
+ (state->err == CLEANUP_STAT_OK) ? "accept" : "reject",
+ state->where, STR(proxy->buffer), smtpd_whatsup(state));
+
+ /*
* Cleanup. The client may send another MAIL command.
*/
saved_err = state->err;
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]