summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-28 08:50:09 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-28 08:50:09 +0000
commit8d064848e02e6eb44eaefd220fe2ea9fec291136 (patch)
tree625eb788bda9971d7b47eef9203417645279659f /usr.sbin/smtpd
parent1414677fc0003cc7c4803bea3ebf12ff6d3744cd (diff)
Log the incoming message size; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/smtp_session.c7
-rw-r--r--usr.sbin/smtpd/smtpd.h3
2 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index ac6d6d552ee..2dffde7c185 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.101 2009/05/28 08:48:46 jacekm Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.102 2009/05/28 08:50:08 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -679,10 +679,12 @@ session_pickup(struct session *s, struct submit_status *ss)
case S_DONE:
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]",
+ log_info("%s: from=<%s@%s>, size=%ld, nrcpts=%zd, proto=%s, "
+ "relay=%s [%s]",
s->s_msg.message_id,
s->s_msg.sender.user,
s->s_msg.sender.domain,
+ s->s_datalen,
s->rcptcount,
s->s_flags & F_EHLO ? "ESMTP" : "SMTP",
s->s_hostname,
@@ -793,6 +795,7 @@ session_read_data(struct session *s, char *line, size_t nread)
size_t i;
if (strcmp(line, ".") == 0) {
+ s->s_datalen = ftell(s->datafp);
if (! safe_fclose(s->datafp))
s->s_msg.status |= S_MESSAGE_TEMPFAILURE;
s->datafp = NULL;
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 5e8735ebde0..98e14e0f3f0 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.118 2009/05/27 13:11:39 jacekm Exp $ */
+/* $OpenBSD: smtpd.h,v 1.119 2009/05/28 08:50:08 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -633,6 +633,7 @@ struct session {
struct message s_msg;
short s_nresp[STATE_COUNT];
size_t rcptcount;
+ long s_datalen;
struct auth s_auth;