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

Merged concurrent changes.

parents 9ea68a04 590bcfd9
No related branches found
No related tags found
No related merge requests found
......@@ -207,6 +207,7 @@ struct act_vacation_context {
const char *handle;
bool mime;
const char *from;
const char *from_normalized;
const char *const *addresses;
};
......@@ -551,6 +552,7 @@ static int ext_vacation_operation_execute
struct sieve_coded_stringlist *addresses = NULL;
string_t *reason, *subject = NULL, *from = NULL, *handle = NULL;
unsigned int source_line;
const char *from_normalized = NULL;
/*
* Read operands
......@@ -635,6 +637,20 @@ static int ext_vacation_operation_execute
sieve_runtime_trace(renv, "VACATION action");
/* Check and normalize :from address */
if ( from != NULL ) {
const char *error;
from_normalized = sieve_address_normalize(from, &error);
if ( from_normalized == NULL) {
sieve_runtime_error(renv,
sieve_error_script_location(renv->script, source_line),
"specified :from address '%s' is invalid for vacation action: %s",
str_sanitize(str_c(from), 128), error);
}
}
/* Add vacation action to the result */
pool = sieve_result_pool(renv->result);
......@@ -645,8 +661,11 @@ static int ext_vacation_operation_execute
act->mime = mime;
if ( subject != NULL )
act->subject = p_strdup(pool, str_c(subject));
if ( from != NULL )
if ( from != NULL ) {
act->from = p_strdup(pool, str_c(from));
act->from_normalized = p_strdup(pool, from_normalized);
}
if ( addresses != NULL )
sieve_coded_stringlist_read_all(addresses, pool, &(act->addresses));
......@@ -816,15 +835,21 @@ static bool act_vacation_send
outmsgid = sieve_get_new_message_id(senv);
/* Produce a proper reply */
rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION);
rfc2822_header_field_write(f, "Message-ID", outmsgid);
rfc2822_header_field_write(f, "Date", message_date_create(ioloop_time));
if ( ctx->from != NULL && *(ctx->from) != '\0' )
rfc2822_header_field_printf(f, "From", "<%s>", ctx->from);
rfc2822_header_field_printf(f, "From", "%s", ctx->from);
else
rfc2822_header_field_printf(f, "From", "<%s>", msgdata->to_address);
/* FIXME: If From header of message has same address, we should use that in
* stead properly include the phrase part.
*/
rfc2822_header_field_printf(f, "To", "<%s>", msgdata->return_path);
rfc2822_header_field_printf(f, "Subject", "%s",
str_sanitize(ctx->subject, 256));
......@@ -844,7 +869,6 @@ static bool act_vacation_send
}
rfc2822_header_field_write(f, "Auto-Submitted", "auto-replied (vacation)");
rfc2822_header_field_write(f, "X-Sieve", SIEVE_IMPLEMENTATION);
rfc2822_header_field_write(f, "Precedence", "bulk");
rfc2822_header_field_write(f, "MIME-Version", "1.0");
......
......@@ -324,30 +324,7 @@ bool sieve_address_validate
{
struct sieve_message_address_parser ctx;
memset(&ctx, 0, sizeof(ctx));bool sieve_validate_rfc2822_mailbox(const char *address, const char **error_r)
{
struct sieve_message_address_parser ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.local_part = t_str_new(128);
ctx.domain = t_str_new(128);
ctx.str = t_str_new(128);
ctx.error = t_str_new(128);
if ( !parse_mailbox_address(&ctx, (const unsigned char *) address,
strlen(address)) ) {
if ( error_r != NULL )
*error_r = str_c(ctx.error);
return FALSE;
}
if ( error_r != NULL )
*error_r = NULL;
return TRUE;
}
ctx.local_part = ctx.domain = ctx.str = t_str_new(128);
ctx.error = t_str_new(128);
......
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.