Skip to content

Commit

Permalink
imapsieve plugin: Fixed crash occurring when a mailbox is opened for …
Browse files Browse the repository at this point in the history
…a user before the imap client object is created.
  • Loading branch information
stephanbosch committed Aug 10, 2016
1 parent 0e8abe2 commit 2987a3c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/plugins/imapsieve/imap-sieve-storage.c
Expand Up @@ -534,6 +534,8 @@ imap_sieve_mailbox_transaction_begin(struct mailbox *box,
if (isuser == NULL || isuser->sieve_active)
return t;

i_assert(isuser->client != NULL);

pool = pool_alloconly_create("imap_sieve_mailbox_transaction", 1024);
ismt = p_new(pool, struct imap_sieve_mailbox_transaction, 1);
ismt->pool = pool;
Expand Down Expand Up @@ -581,6 +583,8 @@ imap_sieve_mailbox_transaction_run(
return 0;
}

i_assert(isuser->client != NULL);

/* Get user script for this mailbox */
if (isuser->user_script && imap_sieve_mailbox_get_script
(box, &script_name) < 0) {
Expand Down Expand Up @@ -756,7 +760,7 @@ static void imap_sieve_mailbox_allocated(struct mailbox *box)
struct mailbox_vfuncs *v = box->vlast;
union mailbox_module_context *lbox;

if (isuser->sieve_active ||
if (isuser->client == NULL || isuser->sieve_active ||
(box->flags & MAILBOX_FLAG_READONLY) != 0)
return;

Expand Down

0 comments on commit 2987a3c

Please sign in to comment.