Skip to content

Commit

Permalink
plugins: imap-filter-sieve: Make sure an (internal) error message is …
Browse files Browse the repository at this point in the history
…available for failed compile.
  • Loading branch information
stephanbosch committed Jan 22, 2021
1 parent 552611e commit 3f007c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plugins/imap-filter-sieve/imap-filter-sieve.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ int imap_filter_sieve_compile(struct imap_filter_sieve_context *sctx,
const char *errormsg =
sieve_script_get_last_error(
script, &error);

if (error != SIEVE_ERROR_NONE) {
str_truncate(sctx->errors, 0);
str_append(sctx->errors, errormsg);
Expand All @@ -444,6 +443,12 @@ int imap_filter_sieve_compile(struct imap_filter_sieve_context *sctx,
}
}

if (ret < 0 && str_len(sctx->errors) == 0) {
/* Failed, but no user error was logged: log a generic internal
error instead. */
sieve_internal_error(ehandler, NULL, NULL);
}

*have_warnings_r = (sieve_get_warnings(ehandler) > 0);
*errors_r = sctx->errors;

Expand Down

0 comments on commit 3f007c7

Please sign in to comment.