From ff2b8ffd89e3e79e74c83ef7b3bfabb29e352241 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Mon, 20 Oct 2008 02:13:27 +0200 Subject: [PATCH] Prevented transaction context from becoming NULL in execution of store action. --- src/lib-sieve/sieve-actions.c | 14 ++++++++------ src/lib-sieve/sieve-result.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c index 039c64b46..2ffc967d0 100644 --- a/src/lib-sieve/sieve-actions.c +++ b/src/lib-sieve/sieve-actions.c @@ -218,10 +218,9 @@ static bool act_store_start /* Open the requested mailbox */ if ( aenv->scriptenv->namespaces != NULL ) { ns = mail_namespace_find(aenv->scriptenv->namespaces, &ctx->folder); - if (ns == NULL) - return FALSE; - - box = act_store_mailbox_open(aenv, ns, ctx->folder); + + if ( ns != NULL ) + box = act_store_mailbox_open(aenv, ns, ctx->folder); } /* Create transaction context */ @@ -301,7 +300,10 @@ static void act_store_log_status mailbox_name = str_sanitize(mailbox_get_name(trans->box), 128); if ( trans->namespace == NULL ) { - sieve_result_log(aenv, "store into mailbox '%s' not performed", mailbox_name); + if ( aenv->scriptenv->namespaces == NULL ) + sieve_result_log(aenv, "store into mailbox '%s' skipped", mailbox_name); + else + sieve_result_error(aenv, "failed to find namespace to store into mailbox '%s'", mailbox_name); } else { if ( !rolled_back && status ) { sieve_result_log(aenv, "stored mail into mailbox '%s'", mailbox_name); @@ -374,7 +376,7 @@ static void act_store_rollback if ( trans->mail_trans != NULL ) mailbox_transaction_rollback(&trans->mail_trans); - /* Close the mailbox */ + /* Close the mailbox */ if ( trans->box != NULL ) mailbox_close(&trans->box); } diff --git a/src/lib-sieve/sieve-result.c b/src/lib-sieve/sieve-result.c index 43fd5fd6b..db59ec8ec 100644 --- a/src/lib-sieve/sieve-result.c +++ b/src/lib-sieve/sieve-result.c @@ -541,7 +541,7 @@ static bool _sieve_result_implicit_keep bool dummy = TRUE; struct act_store_context ctx; struct sieve_result_side_effect *rsef, *rsef_first = NULL; - void *tr_context; + void *tr_context = NULL; ctx.folder = result->action_env.scriptenv->default_mailbox; -- GitLab