summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2019-07-11 21:05:00 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2019-07-11 21:05:00 +0000
commita18217a54d9b44cfa076b5049fe4c4815d7cc0f1 (patch)
treeb2665651f28b20eea42eaf4132425e660c9fb962
parent80d1e0523c92ec2939d20b61c55aac8dd501373e (diff)
modify link-identify so it reports if HELO or EHLO was used
-rw-r--r--usr.sbin/smtpd/lka.c6
-rw-r--r--usr.sbin/smtpd/lka_report.c7
-rw-r--r--usr.sbin/smtpd/report_smtp.c5
-rw-r--r--usr.sbin/smtpd/smtp_session.c6
-rw-r--r--usr.sbin/smtpd/smtpd.h6
5 files changed, 17 insertions, 13 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index b4afcca923a..2d8d29ef204 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.236 2019/07/11 20:58:54 gilles Exp $ */
+/* $OpenBSD: lka.c,v 1.237 2019/07/11 21:04:59 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -83,6 +83,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
const char *command, *response;
const char *ciphers;
const char *address;
+ const char *helomethod;
const char *heloname;
const char *filter_name;
struct sockaddr_storage ss_src, ss_dest;
@@ -405,10 +406,11 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
m_get_string(&m, &direction);
m_get_timeval(&m, &tv);
m_get_id(&m, &reqid);
+ m_get_string(&m, &helomethod);
m_get_string(&m, &heloname);
m_end(&m);
- lka_report_smtp_link_identify(direction, &tv, reqid, heloname);
+ lka_report_smtp_link_identify(direction, &tv, reqid, helomethod, heloname);
return;
case IMSG_REPORT_SMTP_LINK_TLS:
diff --git a/usr.sbin/smtpd/lka_report.c b/usr.sbin/smtpd/lka_report.c
index d37ff5eecec..d7f33c2274c 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.19 2019/07/11 20:58:54 gilles Exp $ */
+/* $OpenBSD: lka_report.c,v 1.20 2019/07/11 21:04:59 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -225,10 +225,11 @@ lka_report_smtp_link_reset(const char *direction, struct timeval *tv, uint64_t r
}
void
-lka_report_smtp_link_identify(const char *direction, struct timeval *tv, uint64_t reqid, const char *heloname)
+lka_report_smtp_link_identify(const char *direction, struct timeval *tv,
+ uint64_t reqid, const char *method, const char *heloname)
{
report_smtp_broadcast(reqid, direction, tv, "link-identify",
- "%016"PRIx64"|%s\n", reqid, heloname);
+ "%016"PRIx64"|%s|%s\n", reqid, method, heloname);
}
void
diff --git a/usr.sbin/smtpd/report_smtp.c b/usr.sbin/smtpd/report_smtp.c
index 32db110ea45..c20e4df20c9 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.5 2019/07/11 20:58:54 gilles Exp $ */
+/* $OpenBSD: report_smtp.c,v 1.6 2019/07/11 21:04:59 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -64,7 +64,7 @@ report_smtp_link_connect(const char *direction, uint64_t qid, const char *rdns,
}
void
-report_smtp_link_identify(const char *direction, uint64_t qid, const char *identity)
+report_smtp_link_identify(const char *direction, uint64_t qid, const char *method, const char *identity)
{
struct timeval tv;
@@ -74,6 +74,7 @@ report_smtp_link_identify(const char *direction, uint64_t qid, const char *ident
m_add_string(p_lka, direction);
m_add_timeval(p_lka, &tv);
m_add_id(p_lka, qid);
+ m_add_string(p_lka, method);
m_add_string(p_lka, identity);
m_close(p_lka);
}
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 17686c0364e..8f5fe22fc78 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.398 2019/07/11 20:58:54 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.399 2019/07/11 21:04:59 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1733,7 +1733,7 @@ smtp_proceed_helo(struct smtp_session *s, const char *args)
(void)strlcpy(s->helo, args, sizeof(s->helo));
s->flags &= SF_SECURE | SF_AUTHENTICATED | SF_VERIFIED;
- report_smtp_link_identify("smtp-in", s->id, s->helo);
+ report_smtp_link_identify("smtp-in", s->id, "HELO", s->helo);
smtp_enter_state(s, STATE_HELO);
smtp_reply(s, "250 %s Hello %s [%s], pleased to meet you",
@@ -1750,7 +1750,7 @@ smtp_proceed_ehlo(struct smtp_session *s, const char *args)
s->flags |= SF_EHLO;
s->flags |= SF_8BITMIME;
- report_smtp_link_identify("smtp-in", s->id, s->helo);
+ report_smtp_link_identify("smtp-in", s->id, "EHLO", s->helo);
smtp_enter_state(s, STATE_HELO);
smtp_reply(s, "250-%s Hello %s [%s], pleased to meet you",
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index c5029f1464a..f9b6ef7ca96 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.626 2019/07/11 20:58:54 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.627 2019/07/11 21:04:59 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1330,7 +1330,7 @@ void lka_report_register_hook(const char *, const char *);
void lka_report_smtp_link_connect(const char *, struct timeval *, uint64_t, const char *, int,
const struct sockaddr_storage *, const struct sockaddr_storage *);
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_identify(const char *, struct timeval *, uint64_t, const char *, 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);
@@ -1498,7 +1498,7 @@ int queue_message_walk(struct envelope *, uint32_t, int *, void **);
void report_smtp_link_connect(const char *, uint64_t, const char *, int,
const struct sockaddr_storage *, const struct sockaddr_storage *);
void report_smtp_link_disconnect(const char *, uint64_t);
-void report_smtp_link_identify(const char *, uint64_t, const char *);
+void report_smtp_link_identify(const char *, uint64_t, const char *, 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);