summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-03-10 22:33:27 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-03-10 22:33:27 +0000
commitc6977743257ce3292ee135a68fdf73453058c074 (patch)
treec9646741c7f6cbf53c2651d0e9c57cdb22b28ad8
parentd977d409e2c564f9087b0e12e9b0c5ce98d64414 (diff)
implement basic logging, needs more work; ok gilles@
-rw-r--r--usr.sbin/smtpd/mda.c11
-rw-r--r--usr.sbin/smtpd/mta.c11
-rw-r--r--usr.sbin/smtpd/smtp_session.c11
-rw-r--r--usr.sbin/smtpd/smtpd.h4
4 files changed, 32 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index f5c3af488f4..7efb37da1b9 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.9 2009/02/22 19:07:33 chl Exp $ */
+/* $OpenBSD: mda.c,v 1.10 2009/03/10 22:33:26 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -433,5 +433,14 @@ mda_remove_message(struct smtpd *env, struct batch *batchp, struct message *mess
imsg_compose(env->sc_ibufs[PROC_QUEUE], IMSG_QUEUE_MESSAGE_UPDATE, 0, 0,
-1, messagep, sizeof (struct message));
+ if ((batchp->message.status & S_MESSAGE_TEMPFAILURE) == 0 &&
+ (batchp->message.status & S_MESSAGE_PERMFAILURE) == 0) {
+ log_info("%s: to=<%s@%s>, delay=%d, stat=Sent",
+ messagep->message_uid,
+ messagep->recipient.user,
+ messagep->recipient.domain,
+ time(NULL) - messagep->creation);
+ }
+
queue_remove_batch_message(env, batchp, messagep);
}
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index c15016b314a..e68ffae6dad 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.32 2009/03/09 01:43:19 gilles Exp $ */
+/* $OpenBSD: mta.c,v 1.33 2009/03/10 22:33:26 jacekm Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1057,6 +1057,15 @@ mta_batch_update_queue(struct batch *batchp)
messagep->status |= S_MESSAGE_TEMPFAILURE;
}
+ if ((messagep->status & S_MESSAGE_TEMPFAILURE) == 0 &&
+ (messagep->status & S_MESSAGE_PERMFAILURE) == 0) {
+ log_info("%s: to=<%s@%s>, delay=%d, stat=Sent",
+ messagep->message_uid,
+ messagep->recipient.user,
+ messagep->recipient.domain,
+ time(NULL) - messagep->creation);
+ }
+
imsg_compose(env->sc_ibufs[PROC_QUEUE],
IMSG_QUEUE_MESSAGE_UPDATE, 0, 0, -1, messagep,
sizeof(struct message));
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 9a42a8d70dc..33aad8bd639 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.59 2009/03/08 19:11:22 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.60 2009/03/10 22:33:26 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -702,6 +702,15 @@ session_pickup(struct session *s, struct submit_status *ss)
s->s_state = S_HELO;
session_respond(s, "250 %s Message accepted for delivery",
s->s_msg.message_id);
+ log_info("%s: from=<%s@%s>, nrcpts=%zd, proto=%s, relay=%s [%s]",
+ s->s_msg.message_uid,
+ s->s_msg.sender.user,
+ s->s_msg.sender.domain,
+ s->rcptcount,
+ s->s_flags & F_EHLO ? "ESMTP" : "SMTP",
+ s->s_hostname,
+ ss_to_text(&s->s_ss));
+
s->s_msg.message_id[0] = '\0';
s->s_msg.message_uid[0] = '\0';
break;
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 0c1ba8fe063..8a6efc26dd3 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.89 2009/03/09 23:35:04 jacekm Exp $ */
+/* $OpenBSD: smtpd.h,v 1.90 2009/03/10 22:33:26 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -610,7 +610,7 @@ struct session {
int s_buflen;
struct timeval s_tv;
struct message s_msg;
- u_int32_t rcptcount;
+ size_t rcptcount;
struct session_auth_req s_auth;