Pass a NULL pointer if no private key set

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
This commit is contained in:
David Goulet 2016-12-08 19:50:56 -05:00
parent 47eded2b2b
commit 7ae2ab49ba

View File

@ -329,6 +329,7 @@ scrambler_mailbox_allocated(struct mailbox *box)
static int
scrambler_istream_opened(struct mail *_mail, struct istream **stream)
{
unsigned char *private_key = NULL;
struct mail_private *mail = (struct mail_private *)_mail;
struct mail_user *user = _mail->box->storage->user;
struct scrambler_user *suser = SCRAMBLER_USER_CONTEXT(user);
@ -336,8 +337,11 @@ scrambler_istream_opened(struct mail *_mail, struct istream **stream)
struct istream *input;
input = *stream;
if (suser->private_key_set) {
private_key = suser->private_key;
}
*stream = scrambler_istream_create(input, suser->public_key,
suser->private_key);
private_key);
i_stream_unref(&input);
return mmail->super.istream_opened(_mail, stream);