RFC5322 allows for escapes using \ inside quotes. Otherwise, headers
such as
From: "\"Doe, John\"" <op>
get mangled as "\"Doe@localhost, John\" <op> 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@
-/* $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 <gilles@poolp.org>
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;