diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2012-09-21 12:33:33 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2012-09-21 12:33:33 +0000 |
commit | 780831e39df02df837f769cd972954e5130d26fa (patch) | |
tree | 4bd63d226a5f89e8da924af6ea1afce188b1a154 /usr.sbin/smtpd/mta.c | |
parent | eddae9a25843931ff5ba7e0a2fcbd872d8c0446d (diff) |
Add a log_envelope() function that log envelope status in a uniform way.
It automagically adds an rcpt=<user@domain> field if "dest" differs from
the original "rcpt". The function takes an "extra" parameter that allows
to add some specific info depending on the context.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/mta.c')
-rw-r--r-- | usr.sbin/smtpd/mta.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index e0aa972fd2b..96592722e59 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.142 2012/09/18 14:23:01 eric Exp $ */ +/* $OpenBSD: mta.c,v 1.143 2012/09/21 12:33:32 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -516,15 +516,12 @@ mta_route_drain(struct mta_route *route) static void mta_envelope_done(struct mta_task *task, struct envelope *e, const char *status) { + char relay[MAX_LINE_SIZE]; + envelope_set_errormsg(e, "%s", status); - log_info("%016" PRIx64 ": to=<%s@%s>, delay=%s, relay=%s, stat=%s (%s)", - e->id, e->dest.user, - e->dest.domain, - duration_to_text(time(NULL) - e->creation), - task->route->hostname, - mta_response_status(e->errorline), - mta_response_text(e->errorline)); + snprintf(relay, sizeof relay, "relay=%s, ", task->route->hostname); + log_envelope(e, relay, e->errorline); imsg_compose_event(env->sc_ievs[PROC_QUEUE], mta_response_delivery(e->errorline), 0, 0, -1, e, sizeof(*e)); |