mutt/2122: Should encrypt messages to the Sender: key as well as to recipients
>Number: 2122
>Notify-List:
>Category: mutt
>Synopsis: Should encrypt messages to the Sender: key as well as to
>recipients
>Confidential: no
>Severity: minor
>Priority: low
>Responsible: mutt-dev
>State: open
>Keywords:
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 28 19:13:00 +0200 2005
>Originator: Javier Fernandez-Sanguino
>Release:
>Organization:
>Environment:
Using Debian
>Description:
Currently, GPG only encrypts messages to the To:, CC: or Bcc: but *not* to the
From: of an email message. This means that any user that sends an encrypted
mail to any other user will not be able to read the e-mail in the future in a
default configuration (see workarounds for possible ways to prevent this)
I don't see any reason for outgoing mail to not be encrypted to the sender's
key so he is able to read it in the future and other software (i.e. PGP
Desktop) does this by default.
I suggest the attached (tested) patch be introduced to mutt to introduce this
new behavior.
>How-To-Repeat:
Send a PGP/GPG encrypted mail to someone (without having 'encrypt-to' with your
own GPG key in the gnupg.options file) and try to open the mail saved on the
folder
>Fix:
The current work around to this issue is either adding 'encrypt-to YourKeyID'
in gnupg.options or e-mailing to yourself (in Bcc: or To:) so that either a)
gnupg encrypts to you by default or b) mutt tells gnupg to encrypt to you (adds
you to the keylist)
>Add-To-Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="mutt_encrypt_from.diff"
Content-Disposition: inline; filename="mutt_encrypt_from.diff"
diff -Nru mutt-1.5.10/crypt.c mutt-1.5.10.encrypt.from/crypt.c
--- mutt-1.5.10/crypt.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/crypt.c 2005-10-28 19:11:11.000000000 +0200
@@ -715,7 +715,7 @@
if ((WithCrypto & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
{
- if ((*keylist = crypt_pgp_findkeys (msg->env->to, msg->env->cc,
+ if ((*keylist = crypt_pgp_findkeys (msg->env->from, msg->env->to,
msg->env->cc,
msg->env->bcc)) == NULL)
return (-1);
unset_option (OPTPGPCHECKTRUST);
@@ -723,7 +723,7 @@
if ((WithCrypto & APPLICATION_SMIME)
&& (msg->security & APPLICATION_SMIME))
{
- if ((*keylist = crypt_smime_findkeys (msg->env->to, msg->env->cc,
+ if ((*keylist = crypt_smime_findkeys (msg->env->from, msg->env->to,
msg->env->cc,
msg->env->bcc)) == NULL)
return (-1);
}
diff -Nru mutt-1.5.10/cryptglue.c mutt-1.5.10.encrypt.from/cryptglue.c
--- mutt-1.5.10/cryptglue.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/cryptglue.c 2005-10-28 19:11:11.000000000
+0200
@@ -200,10 +200,10 @@
/* This routine attempts to find the keyids of the recipients of a
message. It returns NULL if any of the keys can not be found. */
-char *crypt_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *crypt_pgp_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc)
{
if (CRYPT_MOD_CALL_CHECK (PGP, findkeys))
- return (CRYPT_MOD_CALL (PGP, findkeys)) (to, cc, bcc);
+ return (CRYPT_MOD_CALL (PGP, findkeys)) (from, to, cc, bcc);
return NULL;
}
@@ -327,10 +327,10 @@
/* This routine attempts to find the keyids of the recipients of a
message. It returns NULL if any of the keys can not be found. */
-char *crypt_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *crypt_smime_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc)
{
if (CRYPT_MOD_CALL_CHECK (SMIME, findkeys))
- return (CRYPT_MOD_CALL (SMIME, findkeys)) (to, cc, bcc);
+ return (CRYPT_MOD_CALL (SMIME, findkeys)) (from, to, cc, bcc);
return NULL;
}
diff -Nru mutt-1.5.10/crypt-gpgme.c mutt-1.5.10.encrypt.from/crypt-gpgme.c
--- mutt-1.5.10/crypt-gpgme.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/crypt-gpgme.c 2005-10-28 19:11:11.000000000
+0200
@@ -4080,14 +4080,14 @@
return (keylist);
}
-char *pgp_gpgme_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *pgp_gpgme_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc)
{
- return find_keys (to, cc, bcc, APPLICATION_PGP);
+ return find_keys (from, to, cc, bcc, APPLICATION_PGP);
}
-char *smime_gpgme_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *smime_gpgme_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc)
{
- return find_keys (to, cc, bcc, APPLICATION_SMIME);
+ return find_keys (from, to, cc, bcc, APPLICATION_SMIME);
}
/*
diff -Nru mutt-1.5.10/crypt-gpgme.h mutt-1.5.10.encrypt.from/crypt-gpgme.h
--- mutt-1.5.10/crypt-gpgme.h 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/crypt-gpgme.h 2005-10-28 19:11:11.000000000
+0200
@@ -24,8 +24,8 @@
void pgp_gpgme_init (void);
void smime_gpgme_init (void);
-char *pgp_gpgme_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
-char *smime_gpgme_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
+char *pgp_gpgme_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc);
+char *smime_gpgme_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc);
BODY *pgp_gpgme_encrypt_message (BODY *a, char *keylist, int sign);
BODY *smime_gpgme_build_smime_entity (BODY *a, char *keylist);
diff -Nru mutt-1.5.10/crypt-mod.h mutt-1.5.10.encrypt.from/crypt-mod.h
--- mutt-1.5.10/crypt-mod.h 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/crypt-mod.h 2005-10-28 19:11:11.000000000
+0200
@@ -43,7 +43,7 @@
typedef BODY *(*crypt_func_pgp_traditional_encryptsign_t) (BODY *a, int flags,
char *keylist);
typedef BODY *(*crypt_func_pgp_make_key_attachment_t) (char *tempf);
-typedef char *(*crypt_func_findkeys_t) (ADDRESS *to,
+typedef char *(*crypt_func_findkeys_t) (ADDRESS *from, ADDRESS *to,
ADDRESS *cc, ADDRESS *bcc);
typedef BODY *(*crypt_func_sign_message_t) (BODY *a);
typedef BODY *(*crypt_func_pgp_encrypt_message_t) (BODY *a, char *keylist,
diff -Nru mutt-1.5.10/crypt-mod-pgp-classic.c
mutt-1.5.10.encrypt.from/crypt-mod-pgp-classic.c
--- mutt-1.5.10/crypt-mod-pgp-classic.c 2005-08-11 23:22:41.000000000
+0200
+++ mutt-1.5.10.encrypt.from/crypt-mod-pgp-classic.c 2005-10-28
19:11:11.000000000 +0200
@@ -46,9 +46,9 @@
return pgp_application_pgp_handler (m, s);
}
-static char *crypt_mod_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+static char *crypt_mod_pgp_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc,
ADDRESS *bcc)
{
- return pgp_findKeys (to, cc, bcc);
+ return pgp_findKeys (from, to, cc, bcc);
}
static BODY *crypt_mod_pgp_sign_message (BODY *a)
diff -Nru mutt-1.5.10/crypt-mod-pgp-gpgme.c
mutt-1.5.10.encrypt.from/crypt-mod-pgp-gpgme.c
--- mutt-1.5.10/crypt-mod-pgp-gpgme.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/crypt-mod-pgp-gpgme.c 2005-10-28
19:11:11.000000000 +0200
@@ -65,9 +65,9 @@
return pgp_gpgme_check_traditional (fp, b, tagged_only);
}
-static char *crypt_mod_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+static char *crypt_mod_pgp_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc,
ADDRESS *bcc)
{
- return pgp_gpgme_findkeys (to, cc, bcc);
+ return pgp_gpgme_findkeys (from, to, cc, bcc);
}
static BODY *crypt_mod_pgp_sign_message (BODY *a)
diff -Nru mutt-1.5.10/crypt-mod-smime-classic.c
mutt-1.5.10.encrypt.from/crypt-mod-smime-classic.c
--- mutt-1.5.10/crypt-mod-smime-classic.c 2005-08-11 23:22:41.000000000
+0200
+++ mutt-1.5.10.encrypt.from/crypt-mod-smime-classic.c 2005-10-28
19:11:11.000000000 +0200
@@ -46,9 +46,9 @@
return smime_application_smime_handler (m, s);
}
-static char *crypt_mod_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+static char *crypt_mod_smime_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS
*cc, ADDRESS *bcc)
{
- return smime_findKeys (to, cc, bcc);
+ return smime_findKeys (from, to, cc, bcc);
}
static BODY *crypt_mod_smime_sign_message (BODY *a)
diff -Nru mutt-1.5.10/crypt-mod-smime-gpgme.c
mutt-1.5.10.encrypt.from/crypt-mod-smime-gpgme.c
--- mutt-1.5.10/crypt-mod-smime-gpgme.c 2005-08-11 23:22:41.000000000
+0200
+++ mutt-1.5.10.encrypt.from/crypt-mod-smime-gpgme.c 2005-10-28
19:11:11.000000000 +0200
@@ -55,9 +55,9 @@
return smime_gpgme_application_handler (m, s);
}
-static char *crypt_mod_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+static char *crypt_mod_smime_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS
*cc, ADDRESS *bcc)
{
- return smime_gpgme_findkeys (to, cc, bcc);
+ return smime_gpgme_findkeys (from, to, cc, bcc);
}
static BODY *crypt_mod_smime_sign_message (BODY *a)
diff -Nru mutt-1.5.10/mutt_crypt.h mutt-1.5.10.encrypt.from/mutt_crypt.h
--- mutt-1.5.10/mutt_crypt.h 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/mutt_crypt.h 2005-10-28 19:11:11.000000000
+0200
@@ -196,8 +196,8 @@
BODY *crypt_pgp_make_key_attachment (char *tempf);
/* This routine attempts to find the keyids of the recipients of a
- message. It returns NULL if any of the keys can not be found. */
-char *crypt_pgp_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
+ message as well as its sender. It returns NULL if any of the keys can not
be found. */
+char *crypt_pgp_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc);
/* Create a new body with a PGP signed message from A. */
BODY *crypt_pgp_sign_message (BODY *a);
@@ -245,8 +245,8 @@
char *crypt_smime_ask_for_key (char *prompt, char *mailbox, short public);
/* This routine attempts to find the keyids of the recipients of a
- message. It returns NULL if any of the keys can not be found. */
-char *crypt_smime_findkeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
+ message as well as its sender. It returns NULL if any of the keys can not
be found. */
+char *crypt_smime_findkeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS
*bcc);
/* fixme: Needs documentation. */
BODY *crypt_smime_sign_message (BODY *a);
diff -Nru mutt-1.5.10/pgp.c mutt-1.5.10.encrypt.from/pgp.c
--- mutt-1.5.10/pgp.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/pgp.c 2005-10-28 19:11:11.000000000 +0200
@@ -1103,7 +1103,7 @@
/* This routine attempts to find the keyids of the recipients of a message.
* It returns NULL if any of the keys can not be found.
*/
-char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *pgp_findKeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
{
char *keyID, *keylist = NULL, *t;
size_t keylist_size = 0;
@@ -1116,13 +1116,14 @@
const char *fqdn = mutt_fqdn (1);
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 4; i++)
{
switch (i)
{
- case 0: p = to; break;
- case 1: p = cc; break;
- case 2: p = bcc; break;
+ case 0: p = from; break;
+ case 1: p = to; break;
+ case 2: p = cc; break;
+ case 3: p = bcc; break;
default: abort ();
}
diff -Nru mutt-1.5.10/pgp.h mutt-1.5.10.encrypt.from/pgp.h
--- mutt-1.5.10/pgp.h 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/pgp.h 2005-10-28 19:11:11.000000000 +0200
@@ -49,7 +49,7 @@
pgp_key_t pgp_getkeybyaddr (ADDRESS *, short, pgp_ring_t);
pgp_key_t pgp_getkeybystr (char *, short, pgp_ring_t);
-char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
+char *pgp_findKeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
void pgp_forget_passphrase (void);
int pgp_application_pgp_handler (BODY *, STATE *);
diff -Nru mutt-1.5.10/smime.c mutt-1.5.10.encrypt.from/smime.c
--- mutt-1.5.10/smime.c 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/smime.c 2005-10-28 19:11:11.000000000 +0200
@@ -746,7 +746,7 @@
* It returns NULL if any of the keys can not be found.
*/
-char *smime_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
+char *smime_findKeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
{
char *keyID, *keylist = NULL;
size_t keylist_size = 0;
@@ -758,13 +758,14 @@
const char *fqdn = mutt_fqdn (1);
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 4; i++)
{
switch (i)
{
- case 0: p = to; break;
- case 1: p = cc; break;
- case 2: p = bcc; break;
+ case 0: p = from; break;
+ case 1: p = to; break;
+ case 2: p = cc; break;
+ case 3: p = bcc; break;
default: abort ();
}
diff -Nru mutt-1.5.10/smime.h mutt-1.5.10.encrypt.from/smime.h
--- mutt-1.5.10/smime.h 2005-08-11 23:22:41.000000000 +0200
+++ mutt-1.5.10.encrypt.from/smime.h 2005-10-28 19:11:11.000000000 +0200
@@ -50,7 +50,7 @@
char* smime_ask_for_key (char *, char *, short);
-char *smime_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
+char *smime_findKeys (ADDRESS *from, ADDRESS *to, ADDRESS *cc, ADDRESS *bcc);
void smime_invoke_import (char *, char *);