diff options
author | Gilles Chehade <gilles@poolp.org> | 2019-09-19 16:51:28 +0200 |
---|---|---|
committer | Gilles Chehade <gilles@poolp.org> | 2019-09-19 16:51:28 +0200 |
commit | 9d2b35b31d0db3a7155dd62025c51c1436fb1db4 (patch) | |
tree | 80c20016f9bbe16ee3c91e0f2f7247a6bc5be9bf | |
parent | fix build (diff) | |
parent | sync (diff) | |
download | OpenSMTPD-9d2b35b31d0db3a7155dd62025c51c1436fb1db4.tar.xz OpenSMTPD-9d2b35b31d0db3a7155dd62025c51c1436fb1db4.zip |
Merge branch 'master' into portable
-rw-r--r-- | smtpd/mda_variables.c | 4 | ||||
-rw-r--r-- | smtpd/report_smtp.c | 24 | ||||
-rw-r--r-- | smtpd/smtpd.h | 4 |
3 files changed, 25 insertions, 7 deletions
diff --git a/smtpd/mda_variables.c b/smtpd/mda_variables.c index df453477..b672e492 100644 --- a/smtpd/mda_variables.c +++ b/smtpd/mda_variables.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda_variables.c,v 1.5 2018/12/06 12:32:11 gilles Exp $ */ +/* $OpenBSD: mda_variables.c,v 1.6 2019/09/19 07:35:36 gilles Exp $ */ /* * Copyright (c) 2011-2017 Gilles Chehade <gilles@poolp.org> @@ -237,7 +237,7 @@ mda_expand_token(char *dest, size_t len, const char *token, string += begoff; for (; i; i--) { - *dest = (replace && *string == '/') ? ':' : *string; + *dest = *string; dest++; string++; } diff --git a/smtpd/report_smtp.c b/smtpd/report_smtp.c index 085e8195..cb5ef24a 100644 --- a/smtpd/report_smtp.c +++ b/smtpd/report_smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: report_smtp.c,v 1.9 2019/08/28 15:50:36 martijn Exp $ */ +/* $OpenBSD: report_smtp.c,v 1.10 2019/09/19 14:40:53 gilles Exp $ */ /* * Copyright (c) 2018 Gilles Chehade <gilles@poolp.org> @@ -180,6 +180,15 @@ void report_smtp_tx_mail(const char *direction, uint64_t qid, uint32_t msgid, const char *address, int ok) { struct timeval tv; + char buffer[SMTPD_MAXMAILADDRSIZE]; + char *p; + + if ((p = strchr(address, '<')) == NULL) + return; + (void)strlcpy(buffer, p + 1, sizeof buffer); + if ((p = strchr(buffer, '>')) == NULL) + return; + *p = '\0'; gettimeofday(&tv, NULL); @@ -188,7 +197,7 @@ report_smtp_tx_mail(const char *direction, uint64_t qid, uint32_t msgid, const c m_add_timeval(p_lka, &tv); m_add_id(p_lka, qid); m_add_u32(p_lka, msgid); - m_add_string(p_lka, address); + m_add_string(p_lka, buffer); m_add_int(p_lka, ok); m_close(p_lka); } @@ -197,6 +206,15 @@ void report_smtp_tx_rcpt(const char *direction, uint64_t qid, uint32_t msgid, const char *address, int ok) { struct timeval tv; + char buffer[SMTPD_MAXMAILADDRSIZE]; + char *p; + + if ((p = strchr(address, '<')) == NULL) + return; + (void)strlcpy(buffer, p + 1, sizeof buffer); + if ((p = strchr(buffer, '>')) == NULL) + return; + *p = '\0'; gettimeofday(&tv, NULL); @@ -205,7 +223,7 @@ report_smtp_tx_rcpt(const char *direction, uint64_t qid, uint32_t msgid, const c m_add_timeval(p_lka, &tv); m_add_id(p_lka, qid); m_add_u32(p_lka, msgid); - m_add_string(p_lka, address); + m_add_string(p_lka, buffer); m_add_int(p_lka, ok); m_close(p_lka); } diff --git a/smtpd/smtpd.h b/smtpd/smtpd.h index f3999528..a54da734 100644 --- a/smtpd/smtpd.h +++ b/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.637 2019/09/18 11:26:30 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.638 2019/09/19 07:35:36 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -95,7 +95,7 @@ * potentially dangerous and need to be escaped. */ #define MAILADDR_ALLOWED "!#$%&'*/?^`{|}~+-=_" -#define MAILADDR_ESCAPE "!#$%&'*/?^`{|}~" +#define MAILADDR_ESCAPE "!#$%&'*?`{|}~" #define F_STARTTLS 0x01 |