Skip to content

Instantly share code, notes, and snippets.

@duckdalbe
Created February 19, 2015 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duckdalbe/49f1b0171db662074dcc to your computer and use it in GitHub Desktop.
Save duckdalbe/49f1b0171db662074dcc to your computer and use it in GitHub Desktop.
encrypt-to-self-patch for mutt applyable to current head of mutt-kz
--- mutt-1.5.19/crypt.c.orig 2009-01-05 11:20:53.000000000 -0800
+++ mutt-1.5.19/crypt.c 2009-02-04 12:37:45.000000000 -0800
@@ -215,8 +215,21 @@
if ((WithCrypto & APPLICATION_SMIME)
&& (msg->security & APPLICATION_SMIME))
{
- if (!(tmp_pbody = crypt_smime_build_smime_entity (tmp_smime_pbody,
- keylist)))
+ char *new_keylist = keylist;
+
+ if (SmimeDefaultKey && query_quadoption(OPT_SMIMEENCRYPTSELF, _("Encrypt message to S/MIME Default Key also?")) == M_YES)
+ {
+ /* +1 for NULL, +1 for \n */
+ int size = mutt_strlen(keylist) + mutt_strlen(SmimeDefaultKey) + 2;
+ new_keylist = safe_malloc(size);
+ snprintf(new_keylist, size, "%s%s\n", keylist, SmimeDefaultKey);
+ }
+
+ tmp_pbody = crypt_smime_build_smime_entity (tmp_smime_pbody, new_keylist);
+ if (new_keylist != keylist)
+ safe_free((void **)&new_keylist);
+
+ if (!tmp_pbody)
{
/* signed ? free it! */
return (-1);
--- mutt-1.5.19/init.h.orig 2009-02-04 12:22:07.000000000 -0800
+++ mutt-1.5.19/init.h 2009-02-04 12:39:58.000000000 -0800
@@ -2816,6 +2005,12 @@
** possible \fCprintf(3)\fP-like sequences.
** (S/MIME only)
*/
+ { "smime_encrypt_self", DT_QUAD, R_NONE, OPT_SMIMEENCRYPTSELF, M_YES },
+ /*
+ ** .pp
+ ** Encrypt the message to $$smime_default_key too.
+ ** (S/MIME only)
+ */
{ "smime_encrypt_with", DT_STR, R_NONE, UL &SmimeCryptAlg, UL "aes256" },
/*
** .pp
--- mutt-1.5.19/mutt.h.orig 2009-02-04 12:22:07.000000000 -0800
+++ mutt-1.5.19/mutt.h 2009-02-04 12:40:59.000000000 -0800
@@ -273,6 +273,7 @@
OPT_MIMEFWDREST,
OPT_MOVE,
OPT_PGPMIMEAUTO, /* ask to revert to PGP/MIME when inline fails */
+ OPT_SMIMEENCRYPTSELF,
#ifdef USE_POP
OPT_POPDELETE,
OPT_POPRECONNECT,
--- mutt-1.5.19/PATCHES~
+++ mutt-1.5.19/PATCHES
@@ -0,0 +1 @@
+patch-1.5.23.smime-encrypt-self.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment