From a7800f1840ec7df1c35acd2e7cee74c0558d928a Mon Sep 17 00:00:00 2001 From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com> Date: Fri, 14 Feb 2025 17:10:05 -0500 Subject: [PATCH] mod_mailscript: Fix case-sensitive email address comparisons. Compare MAIL FROM and RCPT TO for EQUALS and CONTAINS case-insensitively. Previously, if the case of these two headers differed, the rule would not match. --- modules/mod_mailscript.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mod_mailscript.c b/modules/mod_mailscript.c index d892fbf4..6e44e53b 100644 --- a/modules/mod_mailscript.c +++ b/modules/mod_mailscript.c @@ -212,9 +212,9 @@ static int header_match(struct smtp_msg_process *mproc, const char *header, cons static void __attribute__ ((nonnull (2, 3, 4))) str_match(const char *matchtype, const char *a, const char *expr, int *restrict match) { if (!strcasecmp(matchtype, "EQUALS")) { - *match = !strcmp(a, expr); + *match = !strcasecmp(a, expr); } else if (!strcasecmp(matchtype, "CONTAINS")) { - *match = strstr(a, expr) ? 1 : 0; + *match = strcasestr(a, expr) ? 1 : 0; } else if (!strcasecmp(matchtype, "LIKE")) { regex_t regexbuf; int errcode;