1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-24 22:26:03 +00:00

smtpd: fix using modifiers with partial expansion in format specifiers

Nits on the manpage and ok op@
This commit is contained in:
jtt
2026-04-03 10:18:58 +00:00
parent e33be6833f
commit 130baa166a
2 changed files with 13 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: mda_variables.c,v 1.10 2024/04/23 13:34:51 jsg Exp $ */
/* $OpenBSD: mda_variables.c,v 1.11 2026/04/03 10:18:58 jtt Exp $ */
/*
* Copyright (c) 2011-2017 Gilles Chehade <gilles@poolp.org>
@@ -94,7 +94,8 @@ mda_expand_token(char *dest, size_t len, const char *token,
return -1;
/* token:mod_1,mod_2,mod_n -> extract modifiers */
mods = strchr(rbracket + 1, ':');
if ((mods = strchr(rbracket + 1, ':')) != NULL)
*mods++ = '\0';
} else {
if ((mods = strchr(rtoken, ':')) != NULL)
*mods++ = '\0';

View File

@@ -1,4 +1,4 @@
.\" $OpenBSD: smtpd.conf.5,v 1.281 2026/03/12 07:46:08 jsg Exp $
.\" $OpenBSD: smtpd.conf.5,v 1.282 2026/04/03 10:18:58 jtt Exp $
.\"
.\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org>
.\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -17,7 +17,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
.Dd $Mdocdate: March 12 2026 $
.Dd $Mdocdate: April 3 2026 $
.Dt SMTPD.CONF 5
.Os
.Sh NAME
@@ -1144,6 +1144,14 @@ For example, with recipient
.It %{rcpt:lowercase|strip} Ta expands to Dq user@example.org
.El
.Pp
Modifiers and partial expansion can be used together.
In such cases, the modifiers are applied before the partial expansion.
For example, with sender
.Dq owner-tech+M123456@openbsd.org :
.Bl -column %{sender.user[6:]:strip} -offset indent
.It %{sender.user[6:]:strip} Ta expands to Dq tech
.El
.Pp
For security concerns, expanded values are sanitized and potentially
dangerous characters are replaced with
.Sq \&: .