summaryrefslogtreecommitdiffstats
path: root/pgp.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-08-27 16:13:38 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-08-27 16:13:38 +0000
commit234b078cdacd168648e6e1959a288738d5e39f70 (patch)
tree643b5e799f5953dc401f91b156759023ab6f7abc /pgp.c
parent966265f3218ea6bf287c09f7bac448e6b37ebb1d (diff)
Make $fcc_attach work correctly when sending PGP-encrypted
messages. Hack by Liviu.
Diffstat (limited to 'pgp.c')
-rw-r--r--pgp.c15
1 files changed, 8 insertions, 7 deletions
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)
{