dovecot-2.2-pigeonhole: Finished support for temporary failures.
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Sun Jun 2 17:08:30 EEST 2013
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/ca6735be7bba
changeset: 1779:ca6735be7bba
user: Stephan Bosch <stephan at rename-it.nl>
date: Sun Jun 02 16:08:22 2013 +0200
description:
Finished support for temporary failures.
This change is bigger than I would have liked, so this needs to be tested more.
diffstat:
src/lib-sieve/cmd-discard.c | 6 +-
src/lib-sieve/cmd-redirect.c | 23 +-
src/lib-sieve/ext-reject.c | 14 +-
src/lib-sieve/plugins/enotify/cmd-notify.c | 6 +-
src/lib-sieve/plugins/imap4flags/tag-flags.c | 6 +-
src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 27 +-
src/lib-sieve/plugins/notify/cmd-notify.c | 6 +-
src/lib-sieve/plugins/vacation/cmd-vacation.c | 26 +-
src/lib-sieve/plugins/vnd.dovecot/duplicate/ext-duplicate-common.c | 6 +-
src/lib-sieve/sieve-actions.c | 99 +-
src/lib-sieve/sieve-actions.h | 10 +-
src/lib-sieve/sieve-binary-file.c | 14 +-
src/lib-sieve/sieve-result.c | 139 +-
src/lib-sieve/sieve-result.h | 4 +-
src/lib-sieve/sieve-script-dict.c | 12 +-
src/lib-sieve/sieve-script-file.c | 16 +-
src/lib-sieve/sieve-script.c | 4 +-
src/lib-sieve/sieve-types.h | 13 +-
src/lib-sieve/sieve.c | 74 +-
src/lib-sieve/sieve.h | 2 +
src/lib-sievestorage/sieve-storage.c | 4 +-
src/managesieve/managesieve-client.c | 2 +-
src/plugins/lda-sieve/lda-sieve-plugin.c | 660 +++++----
src/plugins/sieve-extprograms/cmd-pipe.c | 13 +-
src/plugins/sieve-extprograms/sieve-extprograms-common.c | 10 +-
src/sieve-tools/sieve-filter.c | 5 +-
src/sieve-tools/sieve-test.c | 8 +-
src/testsuite/testsuite.c | 3 +-
28 files changed, 702 insertions(+), 510 deletions(-)
diffs (truncated from 2598 to 300 lines):
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/cmd-discard.c
--- a/src/lib-sieve/cmd-discard.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/cmd-discard.c Sun Jun 02 16:08:22 2013 +0200
@@ -58,7 +58,7 @@
static void act_discard_print
(const struct sieve_action *action,
const struct sieve_result_print_env *rpenv, bool *keep);
-static bool act_discard_commit
+static int act_discard_commit
(const struct sieve_action *action,
const struct sieve_action_exec_env *aenv, void *tr_context, bool *keep);
@@ -128,7 +128,7 @@
*keep = FALSE;
}
-static bool act_discard_commit
+static int act_discard_commit
(const struct sieve_action *action ATTR_UNUSED,
const struct sieve_action_exec_env *aenv,
void *tr_context ATTR_UNUSED, bool *keep)
@@ -138,6 +138,6 @@
"(discard action)");
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/cmd-redirect.c
--- a/src/lib-sieve/cmd-redirect.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/cmd-redirect.c Sun Jun 02 16:08:22 2013 +0200
@@ -87,7 +87,7 @@
static void act_redirect_print
(const struct sieve_action *action, const struct sieve_result_print_env *rpenv,
bool *keep);
-static bool act_redirect_commit
+static int act_redirect_commit
(const struct sieve_action *action, const struct sieve_action_exec_env *aenv,
void *tr_context, bool *keep);
@@ -307,7 +307,7 @@
*keep = FALSE;
}
-static bool act_redirect_send
+static int act_redirect_send
(const struct sieve_action_exec_env *aenv, struct mail *mail,
struct act_redirect_context *ctx)
{
@@ -326,11 +326,11 @@
if ( !sieve_smtp_available(senv) ) {
sieve_result_global_warning
(aenv, "redirect action has no means to send mail.");
- return TRUE;
+ return SIEVE_EXEC_FAILURE;
}
if (mail_get_stream(mail, NULL, NULL, &input) < 0)
- return FALSE;
+ return SIEVE_EXEC_TEMP_FAILURE;
/* Open SMTP transport */
smtp_handle = sieve_smtp_open(senv, ctx->to_address, sender, &output);
@@ -359,13 +359,13 @@
"failed to redirect message to <%s> "
"(refer to server log for more information)",
str_sanitize(ctx->to_address, 80));
- return FALSE;
+ return SIEVE_EXEC_FAILURE;
}
- return TRUE;
+ return SIEVE_EXEC_OK;
}
-static bool act_redirect_commit
+static int act_redirect_commit
(const struct sieve_action *action,
const struct sieve_action_exec_env *aenv, void *tr_context ATTR_UNUSED,
bool *keep)
@@ -378,6 +378,7 @@
const struct sieve_script_env *senv = aenv->scriptenv;
const char *orig_recipient = sieve_message_get_orig_recipient(aenv->msgctx);
const char *dupeid;
+ int ret;
/* Prevent mail loops if possible */
dupeid = msgdata->id == NULL ? NULL : t_strdup_printf
@@ -388,12 +389,12 @@
sieve_result_global_log(aenv, "discarded duplicate forward to <%s>",
str_sanitize(ctx->to_address, 128));
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
}
/* Try to forward the message */
- if ( act_redirect_send(aenv, mail, ctx) ) {
+ if ( (ret=act_redirect_send(aenv, mail, ctx)) == SIEVE_EXEC_OK) {
/* Mark this message id as forwarded to the specified destination */
if (dupeid != NULL) {
@@ -410,10 +411,10 @@
/* Cancel implicit keep */
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
- return FALSE;
+ return ret;
}
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/ext-reject.c
--- a/src/lib-sieve/ext-reject.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/ext-reject.c Sun Jun 02 16:08:22 2013 +0200
@@ -181,7 +181,7 @@
static void act_reject_print
(const struct sieve_action *action,
const struct sieve_result_print_env *rpenv, bool *keep);
-static bool act_reject_commit
+static int act_reject_commit
(const struct sieve_action *action ATTR_UNUSED,
const struct sieve_action_exec_env *aenv, void *tr_context, bool *keep);
@@ -379,7 +379,7 @@
*keep = FALSE;
}
-static bool act_reject_commit
+static int act_reject_commit
(const struct sieve_action *action, const struct sieve_action_exec_env *aenv,
void *tr_context ATTR_UNUSED, bool *keep)
{
@@ -391,7 +391,7 @@
if ( recipient == NULL ) {
sieve_result_global_warning(aenv,
"reject action aborted: envelope recipient is <>");
- return TRUE;
+ return SIEVE_EXEC_OK;
}
if ( rj_ctx->reason == NULL ) {
@@ -399,14 +399,14 @@
"not sending reject message (would cause second response to sender)");
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
if ( sender == NULL ) {
sieve_result_global_log(aenv, "not sending reject message to <>");
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
if ( sieve_action_reject_mail(aenv, sender, recipient, rj_ctx->reason) ) {
@@ -415,10 +415,10 @@
( rj_ctx->ereject ? "ereject" : "reject" ));
*keep = FALSE;
- return TRUE;
+ return SIEVE_EXEC_OK;
}
- return FALSE;
+ return SIEVE_EXEC_FAILURE;
}
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/plugins/enotify/cmd-notify.c
--- a/src/lib-sieve/plugins/enotify/cmd-notify.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/plugins/enotify/cmd-notify.c Sun Jun 02 16:08:22 2013 +0200
@@ -136,7 +136,7 @@
static void act_notify_print
(const struct sieve_action *action, const struct sieve_result_print_env *rpenv,
bool *keep);
-static bool act_notify_commit
+static int act_notify_commit
(const struct sieve_action *action, const struct sieve_action_exec_env *aenv,
void *tr_context, bool *keep);
@@ -566,7 +566,7 @@
/* Result execution */
-static bool act_notify_commit
+static int act_notify_commit
(const struct sieve_action *action, const struct sieve_action_exec_env *aenv,
void *tr_context ATTR_UNUSED, bool *keep ATTR_UNUSED)
{
@@ -593,7 +593,7 @@
sieve_error_handler_unref(&nenv.ehandler);
}
- return result;
+ return ( result ? SIEVE_EXEC_OK : SIEVE_EXEC_FAILURE );
}
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/plugins/imap4flags/tag-flags.c
--- a/src/lib-sieve/plugins/imap4flags/tag-flags.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/plugins/imap4flags/tag-flags.c Sun Jun 02 16:08:22 2013 +0200
@@ -70,7 +70,7 @@
static void seff_flags_print
(const struct sieve_side_effect *seffect, const struct sieve_action *action,
const struct sieve_result_print_env *rpenv, bool *keep);
-static bool seff_flags_pre_execute
+static int seff_flags_pre_execute
(const struct sieve_side_effect *seffect, const struct sieve_action *action,
const struct sieve_action_exec_env *aenv, void **context, void *tr_context);
@@ -383,7 +383,7 @@
/* Result execution */
-static bool seff_flags_pre_execute
+static int seff_flags_pre_execute
(const struct sieve_side_effect *seffect,
const struct sieve_action *action ATTR_UNUSED,
const struct sieve_action_exec_env *aenv, void **context, void *tr_context)
@@ -402,7 +402,7 @@
sieve_act_store_add_flags(aenv, tr_context, keywords, ctx->flags);
- return TRUE;
+ return SIEVE_EXEC_OK;
}
diff -r eff46ace3456 -r ca6735be7bba src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
--- a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c Fri May 24 13:12:24 2013 +0200
+++ b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c Sun Jun 02 16:08:22 2013 +0200
@@ -41,7 +41,7 @@
static void seff_mailbox_create_print
(const struct sieve_side_effect *seffect, const struct sieve_action *action,
const struct sieve_result_print_env *rpenv, bool *keep);
-static bool seff_mailbox_create_pre_execute
+static int seff_mailbox_create_pre_execute
(const struct sieve_side_effect *seffect, const struct sieve_action *action,
const struct sieve_action_exec_env *aenv, void **se_context,
void *tr_context);
@@ -113,7 +113,7 @@
sieve_result_seffect_printf(rpenv, "create mailbox if it does not exist");
}
-static bool seff_mailbox_create_pre_execute
+static int seff_mailbox_create_pre_execute
(const struct sieve_side_effect *seffect ATTR_UNUSED,
const struct sieve_action *action ATTR_UNUSED,
const struct sieve_action_exec_env *aenv ATTR_UNUSED,
@@ -126,17 +126,22 @@
/* Check whether creation is necessary */
if ( trans->box == NULL || trans->disabled )
- return TRUE;
+ return SIEVE_EXEC_OK;
/* Check whether creation has a chance of working */
- if ( trans->error_code != MAIL_ERROR_NONE &&
- trans->error_code != MAIL_ERROR_NOTFOUND )
- return FALSE;
+ switch ( trans->error_code ) {
+ case MAIL_ERROR_NONE:
+ case MAIL_ERROR_NOTFOUND:
+ break;
+ case MAIL_ERROR_TEMP:
+ return SIEVE_EXEC_TEMP_FAILURE;
+ default:
+ return SIEVE_EXEC_FAILURE;
+ }
trans->error = NULL;
trans->error_code = MAIL_ERROR_NONE;
-
*storage = mailbox_get_storage(trans->box);
/* Create mailbox */
@@ -144,7 +149,8 @@
(void)mail_storage_get_last_error(*storage, &error);
if ( error != MAIL_ERROR_EXISTS ) {
sieve_act_store_get_storage_error(aenv, trans);
- return FALSE;
+ return ( trans->error_code == MAIL_ERROR_TEMP ?
+ SIEVE_EXEC_TEMP_FAILURE : SIEVE_EXEC_FAILURE );
}
}
@@ -159,10 +165,11 @@
if ( mailbox_open(trans->box) < 0 ) {
/* Failed definitively */
sieve_act_store_get_storage_error(aenv, trans);
More information about the dovecot-cvs
mailing list