Allow internal TLDs and special characters in e-mail addresses

This commit is contained in:
Maurus Decimus
2026-05-20 06:51:34 +02:00
parent 83a1543483
commit e9f9d81866
2 changed files with 13 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
- ACME: - ACME:
- Update `defaultCertificateId` when renewing a certificate that is currently set as default. - Update `defaultCertificateId` when renewing a certificate that is currently set as default.
- Perform `DNS-01` authorizations sequentially to avoid race conditions in some DNS providers. - Perform `DNS-01` authorizations sequentially to avoid race conditions in some DNS providers.
- Allow internal TLDs in e-mail addresses. - Allow internal TLDs and special characters in e-mail addresses.
- Websocket: Perform case insensitive matching during upgrade. - Websocket: Perform case insensitive matching during upgrade.
- LDAP: Synchronize accounts when expanding mailing list recipients. - LDAP: Synchronize accounts when expanding mailing list recipients.
- Sieve: `replace` action adds an extra `From` header. - Sieve: `replace` action adds an extra `From` header.

View File

@@ -213,10 +213,14 @@ pub fn sanitize_email(email: &str) -> Option<String> {
for ch in chars.by_ref() { for ch in chars.by_ref() {
match ch { match ch {
'.' | '+' | '-' | '_' => { '.' => {
if !last_ch.is_alphanumeric() { if last_ch == NIL_CHAR || last_ch == '.' {
return None; return None;
} }
result.push('.');
}
'!' | '#' | '$' | '%' | '&' | '\'' | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_'
| '`' | '{' | '|' | '}' | '~' => {
result.push(ch); result.push(ch);
} }
' ' | '\x09'..='\x0d' => continue, ' ' | '\x09'..='\x0d' => continue,
@@ -288,10 +292,14 @@ pub fn sanitize_email_local(local: &str) -> Option<String> {
for ch in local.chars() { for ch in local.chars() {
match ch { match ch {
'.' | '+' | '-' | '_' => { '.' => {
if !last_ch.is_alphanumeric() { if last_ch == NIL_CHAR || last_ch == '.' {
return None; return None;
} }
result.push('.');
}
'!' | '#' | '$' | '%' | '&' | '\'' | '*' | '+' | '-' | '/' | '=' | '?' | '^' | '_'
| '`' | '{' | '|' | '}' | '~' => {
result.push(ch); result.push(ch);
} }
' ' | '\x09'..='\x0d' => continue, ' ' | '\x09'..='\x0d' => continue,