From 4efeaa216c8aca54defd4d31ca72baf24c80664d Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Wed, 11 Dec 2019 10:23:45 +0100 Subject: [PATCH] lib-sieve: plugins: vacation: cmd-vacation - Perform all address comparisons case-insensitively. --- src/lib-sieve/plugins/vacation/cmd-vacation.c | 6 ++-- tests/extensions/vacation/reply.svtest | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/lib-sieve/plugins/vacation/cmd-vacation.c b/src/lib-sieve/plugins/vacation/cmd-vacation.c index 257841cf2..91d2e71b1 100644 --- a/src/lib-sieve/plugins/vacation/cmd-vacation.c +++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c @@ -891,7 +891,7 @@ _msg_address_equals(const struct message_address *addr1, i_assert(addr1->mailbox != NULL); return (smtp_address_init_from_msg(&saddr, addr1) >= 0 && - smtp_address_equals(addr2, &saddr)); + smtp_address_equals_icase(addr2, &saddr)); } static inline bool @@ -1276,7 +1276,7 @@ act_vacation_commit(const struct sieve_action_exec_env *aenv, /* Are we perhaps trying to respond to ourselves ? */ - if (smtp_address_equals(sender, recipient)) { + if (smtp_address_equals_icase(sender, recipient)) { sieve_result_global_log( aenv, "discarded vacation reply to own address <%s>", smtp_address_encode(sender)); @@ -1290,7 +1290,7 @@ act_vacation_commit(const struct sieve_action_exec_env *aenv, alt_address = ctx->addresses; while (*alt_address != NULL) { - if (smtp_address_equals(sender, *alt_address)) { + if (smtp_address_equals_icase(sender, *alt_address)) { sieve_result_global_log( aenv, "discarded vacation reply to own address <%s> " diff --git a/tests/extensions/vacation/reply.svtest b/tests/extensions/vacation/reply.svtest index 49061beb7..55cc58d4f 100644 --- a/tests/extensions/vacation/reply.svtest +++ b/tests/extensions/vacation/reply.svtest @@ -396,6 +396,36 @@ test "Reply for :addresses" { } } +/* + * Reply for :addresses (case sensitivity) + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: Stephan.Bosch@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "Reply for :addresses (case sensitivity)" { + vacation :addresses "stephan.bosch@example.com" "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + /* * Reply for original recipient */ -- GitLab