From e2a5c75b38233d25d02b7b92170ccb8dbff8340d Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sun, 28 Jan 2024 17:23:18 +0000 Subject: allow escaping inside quotes RFC5322 allows for escapes using \ inside quotes. Otherwise, headers such as From: "\"Doe, John\"" get mangled as "\"Doe@localhost, John\" since \ would be treated as ordinary character and not the escape for the quote. Bug reported by TobiasEgg on the OpenSMTPD-portable github repository. ok millert@ --- usr.sbin/smtpd/smtp_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin/smtpd') diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 94763e6d078..3a99cb4f6b9 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.440 2024/01/20 09:01:03 claudio Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.441 2024/01/28 17:23:17 op Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -489,7 +489,7 @@ header_domain_append_callback(struct smtp_tx *tx, const char *hdr, quote = !quote; if (line[i] == ')' && !escape && !quote && comment) comment--; - if (line[i] == '\\' && !escape && !comment && !quote) + if (line[i] == '\\' && !escape && !comment) escape = 1; else escape = 0; -- cgit v1.2.3