Skip to content
Snippets Groups Projects
Commit e6586cb7 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Notify (deprecated): added runtime check for duplicate recipients.

parent 445934a2
No related branches found
No related tags found
No related merge requests found
......@@ -649,18 +649,40 @@ static int cmd_notify_operation_execute
const char *error;
const char *addr_norm = sieve_address_normalize(raw_address, &error);
/* Add if valid address */
if ( addr_norm != NULL ) {
struct ext_notify_recipient recipient;
recipient.full = p_strdup(pool, str_c(raw_address));
recipient.normalized = p_strdup(pool, addr_norm);
const struct ext_notify_recipient *rcpts;
unsigned int rcpt_count, i;
/* Prevent duplicates */
rcpts = array_get(&act->recipients, &rcpt_count);
for ( i = 0; i < rcpt_count; i++ ) {
if ( sieve_address_compare
(rcpts[i].normalized, addr_norm, TRUE) == 0 )
break;
}
/* Add only if unique */
if ( i != rcpt_count ) {
sieve_runtime_warning(renv,
sieve_error_script_location(renv->script, source_line),
"duplicate recipient '%s' specified in the :options argument of "
"the deprecated notify command",
str_sanitize(str_c(raw_address), 128));
} else {
struct ext_notify_recipient recipient;
recipient.full = p_strdup(pool, str_c(raw_address));
recipient.normalized = p_strdup(pool, addr_norm);
array_append(&act->recipients, &recipient, 1);
array_append(&act->recipients, &recipient, 1);
}
} else {
sieve_runtime_error(renv,
sieve_error_script_location(renv->script, source_line),
"specified :options address '%s' is invalid for "
"the mailto notify method: %s",
"the deprecated notify command: %s",
str_sanitize(str_c(raw_address), 128), error);
return SIEVE_EXEC_FAILURE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.