Skip to content

Commit

Permalink
mod_mail: Compare domain names case-insensitively.
Browse files Browse the repository at this point in the history
Previously, domain comparisons were done case-sensitively, but domain
names aren't case sensitive, so this could cause delivery failure when
domains weren't detected to be local because of a case mismatch. They
are now compared case-insensitively.
  • Loading branch information
InterLinked1 committed Jan 2, 2025
1 parent f414c5b commit 22c91ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/mod_mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ int smtp_domain_matches(const char *domain, const char *addr)
addr++;
return strlen_zero(addr); /* Should be the end of that now */
} else {
return !strcmp(domain, addr);
/* Domains are case-insensitive */
return !strcasecmp(domain, addr);
}
}

Expand All @@ -106,7 +107,7 @@ int mail_domain_is_local(const char *domain)
if (smtp_domain_matches(bbs_hostname(), domain)) {
return 1;
}
if (stringlist_contains(&local_domains, domain)) {
if (stringlist_case_contains(&local_domains, domain)) { /* Domains are case-insensitive */
return 1;
}
bbs_debug(5, "Domain '%s' is not local\n", domain);
Expand Down

0 comments on commit 22c91ac

Please sign in to comment.