From 234b078cdacd168648e6e1959a288738d5e39f70 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 27 Aug 1998 16:13:38 +0000 Subject: Make $fcc_attach work correctly when sending PGP-encrypted messages. Hack by Liviu. --- pgp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'pgp.c') diff --git a/pgp.c b/pgp.c index 28c1fac8..35b17038 100644 --- a/pgp.c +++ b/pgp.c @@ -1181,6 +1181,8 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc) return (keylist); } +/* Warning: "a" is no longer free()d in this routine, you need + * to free() it later. This is necessary for $fcc_attach. */ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) { char buf[LONG_STRING]; @@ -1305,14 +1307,11 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) t->parts->next->use_disp = 0; t->parts->next->unlink = 1; /* delete after sending the message */ - mutt_free_body (&a); /* no longer needed! */ - return (t); } -int pgp_protect (HEADER *msg) +int pgp_protect (HEADER *msg, char **pgpkeylist) { - char *pgpkeylist = NULL; BODY *pbody = NULL; /* Do a quick check to make sure that we can find all of the encryption @@ -1323,7 +1322,7 @@ int pgp_protect (HEADER *msg) if (msg->pgp & PGPENCRYPT) { - if ((pgpkeylist = pgp_findKeys (msg->env->to, msg->env->cc, msg->env->bcc)) == NULL) + if ((*pgpkeylist = pgp_findKeys (msg->env->to, msg->env->cc, msg->env->bcc)) == NULL) return (-1); } @@ -1333,10 +1332,12 @@ int pgp_protect (HEADER *msg) endwin (); if (msg->pgp & PGPENCRYPT) { - pbody = pgp_encrypt_message (msg->content, pgpkeylist, msg->pgp & PGPSIGN); - safe_free ((void **) &pgpkeylist); + pbody = pgp_encrypt_message (msg->content, *pgpkeylist, msg->pgp & PGPSIGN); if (!pbody) + { + FREE (pgpkeylist); return (-1); + } } else if (msg->pgp & PGPSIGN) { -- cgit v1.2.3