diff options
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/lka.c | 12 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka_report.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/report_smtp.c | 16 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 5 |
5 files changed, 42 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 6548700e33a..b4afcca923a 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.235 2019/06/27 05:14:49 martijn Exp $ */ +/* $OpenBSD: lka.c,v 1.236 2019/07/11 20:58:54 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -422,6 +422,16 @@ lka_imsg(struct mproc *p, struct imsg *imsg) lka_report_smtp_link_tls(direction, &tv, reqid, ciphers); return; + case IMSG_REPORT_SMTP_LINK_RESET: + m_msg(&m, imsg); + m_get_string(&m, &direction); + m_get_timeval(&m, &tv); + m_get_id(&m, &reqid); + m_end(&m); + + lka_report_smtp_link_reset(direction, &tv, reqid); + return; + case IMSG_REPORT_SMTP_TX_BEGIN: m_msg(&m, imsg); m_get_string(&m, &direction); diff --git a/usr.sbin/smtpd/lka_report.c b/usr.sbin/smtpd/lka_report.c index f48e9ea8999..d37ff5eecec 100644 --- a/usr.sbin/smtpd/lka_report.c +++ b/usr.sbin/smtpd/lka_report.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_report.c,v 1.18 2019/07/09 15:43:24 gilles Exp $ */ +/* $OpenBSD: lka_report.c,v 1.19 2019/07/11 20:58:54 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -53,6 +53,7 @@ static struct smtp_events { { "link-disconnect" }, { "link-identify" }, { "link-tls" }, + { "link-reset" }, { "tx-begin" }, { "tx-mail" }, @@ -217,6 +218,13 @@ lka_report_smtp_link_disconnect(const char *direction, struct timeval *tv, uint6 } void +lka_report_smtp_link_reset(const char *direction, struct timeval *tv, uint64_t reqid) +{ + report_smtp_broadcast(reqid, direction, tv, "link-reset", + "%016"PRIx64"\n", reqid); +} + +void lka_report_smtp_link_identify(const char *direction, struct timeval *tv, uint64_t reqid, const char *heloname) { report_smtp_broadcast(reqid, direction, tv, "link-identify", diff --git a/usr.sbin/smtpd/report_smtp.c b/usr.sbin/smtpd/report_smtp.c index a4268909e58..32db110ea45 100644 --- a/usr.sbin/smtpd/report_smtp.c +++ b/usr.sbin/smtpd/report_smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: report_smtp.c,v 1.4 2019/01/05 09:43:39 gilles Exp $ */ +/* $OpenBSD: report_smtp.c,v 1.5 2019/07/11 20:58:54 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -108,6 +108,20 @@ report_smtp_link_disconnect(const char *direction, uint64_t qid) } void +report_smtp_link_reset(const char *direction, uint64_t qid) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + + m_create(p_lka, IMSG_REPORT_SMTP_LINK_RESET, 0, 0, -1); + m_add_string(p_lka, direction); + m_add_timeval(p_lka, &tv); + m_add_id(p_lka, qid); + m_close(p_lka); +} + +void report_smtp_tx_begin(const char *direction, uint64_t qid, uint32_t msgid) { struct timeval tv; diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 4484ec38fcd..17686c0364e 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.397 2019/07/11 11:56:52 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.398 2019/07/11 20:58:54 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1721,6 +1721,8 @@ smtp_proceed_rset(struct smtp_session *s, const char *args) smtp_tx_free(s->tx); } + report_smtp_link_reset("smtp-in", s->id); + smtp_reply(s, "250 %s: Reset state", esc_code(ESC_STATUS_OK, ESC_OTHER_STATUS)); } diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index e231f5375ec..c5029f1464a 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.625 2019/06/27 05:14:49 martijn Exp $ */ +/* $OpenBSD: smtpd.h,v 1.626 2019/07/11 20:58:54 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -311,6 +311,7 @@ enum imsg_type { IMSG_REPORT_SMTP_LINK_DISCONNECT, IMSG_REPORT_SMTP_LINK_IDENTIFY, IMSG_REPORT_SMTP_LINK_TLS, + IMSG_REPORT_SMTP_LINK_RESET, IMSG_REPORT_SMTP_TX_BEGIN, IMSG_REPORT_SMTP_TX_MAIL, IMSG_REPORT_SMTP_TX_RCPT, @@ -1331,6 +1332,7 @@ void lka_report_smtp_link_connect(const char *, struct timeval *, uint64_t, cons void lka_report_smtp_link_disconnect(const char *, struct timeval *, uint64_t); void lka_report_smtp_link_identify(const char *, struct timeval *, uint64_t, const char *); void lka_report_smtp_link_tls(const char *, struct timeval *, uint64_t, const char *); +void lka_report_smtp_link_reset(const char *, struct timeval *, uint64_t); void lka_report_smtp_tx_begin(const char *, struct timeval *, uint64_t, uint32_t); void lka_report_smtp_tx_mail(const char *, struct timeval *, uint64_t, uint32_t, const char *, int); void lka_report_smtp_tx_rcpt(const char *, struct timeval *, uint64_t, uint32_t, const char *, int); @@ -1498,6 +1500,7 @@ void report_smtp_link_connect(const char *, uint64_t, const char *, int, void report_smtp_link_disconnect(const char *, uint64_t); void report_smtp_link_identify(const char *, uint64_t, const char *); void report_smtp_link_tls(const char *, uint64_t, const char *); +void report_smtp_link_reset(const char *, uint64_t); void report_smtp_tx_begin(const char *, uint64_t, uint32_t); void report_smtp_tx_mail(const char *, uint64_t, uint32_t, const char *, int); void report_smtp_tx_rcpt(const char *, uint64_t, uint32_t, const char *, int); |