aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2019-12-21 10:34:32 +0000
committergilles <gilles@openbsd.org>2019-12-21 10:34:32 +0000
commit1b97b28598a0590f99ef30d5f71970cbb6129890 (patch)
tree4a6f16c35250fb20ba84079c053a15e4a60ea0d7
parentkeep track of the relay action in relays, will be used for smtp-out (diff)
downloadOpenSMTPD-1b97b28598a0590f99ef30d5f71970cbb6129890.tar.xz
OpenSMTPD-1b97b28598a0590f99ef30d5f71970cbb6129890.zip
keep track of DATA length in mta_session, will be needed for smtp-out
reporting
-rw-r--r--mta_session.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mta_session.c b/mta_session.c
index 72969e0a..ef47e88e 100644
--- a/mta_session.c
+++ b/mta_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta_session.c,v 1.122 2019/09/20 17:46:05 gilles Exp $ */
+/* $OpenBSD: mta_session.c,v 1.123 2019/12/21 10:34:32 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -128,6 +128,7 @@ struct mta_session {
struct mta_task *task;
struct mta_envelope *currevp;
FILE *datafp;
+ size_t datalen;
size_t failures;
@@ -362,8 +363,10 @@ mta_free(struct mta_session *s)
if (s->task)
fatalx("current task should have been deleted already");
- if (s->datafp)
+ if (s->datafp) {
fclose(s->datafp);
+ s->datalen = 0;
+ }
free(s->helo);
relay = s->relay;
@@ -814,6 +817,7 @@ again:
if (s->datafp) {
fclose(s->datafp);
s->datafp = NULL;
+ s->datalen = 0;
}
mta_send(s, "RSET");
break;
@@ -1344,7 +1348,7 @@ mta_queue_data(struct mta_session *s)
break;
if (ln[len - 1] == '\n')
ln[len - 1] = '\0';
- io_xprintf(s->io, "%s%s\r\n", *ln == '.' ? "." : "", ln);
+ s->datalen += io_xprintf(s->io, "%s%s\r\n", *ln == '.' ? "." : "", ln);
}
free(ln);