summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2024-04-13 18:31:59 +0800
committerKevin McCarthy <kevin@8t8.us>2024-04-13 18:31:59 +0800
commit680042df1b117abad20cc94ad51a92c7c90e4f0d (patch)
tree9cd964336a33ef294781caa8118e8ebe087a845c
parent3c98bfa875bff795f63597d14322564c2216994f (diff)
parent0d75d71a6f1b6a8a24ccb7fe4e6a9889b4ff8b0b (diff)
Merge branch 'stable'
-rw-r--r--contrib/smime.rc8
-rw-r--r--crypt.c11
-rw-r--r--globals.h1
-rw-r--r--init.h14
4 files changed, 31 insertions, 3 deletions
diff --git a/contrib/smime.rc b/contrib/smime.rc
index 05c4dffc..dfcd13ea 100644
--- a/contrib/smime.rc
+++ b/contrib/smime.rc
@@ -104,6 +104,14 @@ set smime_verify_opaque_command="\
openssl smime -verify -inform DER -in %s %C || \
openssl smime -verify -inform DER -in %s -noverify 2>/dev/null"
+# application/pkcs7-mime ".p7m" messages should have a smime-type
+# parameter to tell Mutt whether it's signed or encrypted data.
+#
+# If the parameter is missing, Mutt by default assumes it's SignedData.
+# This can be used to change Mutt's assumption to EnvelopedData (encrypted).
+#
+# set smime_pkcs7_default_smime_type="enveloped"
+
# Section D: Alternatives
diff --git a/crypt.c b/crypt.c
index a9f7089d..245a7d2a 100644
--- a/crypt.c
+++ b/crypt.c
@@ -610,9 +610,14 @@ int mutt_is_application_smime (BODY *m)
{
len++;
if (!ascii_strcasecmp ((t+len), "p7m"))
- /* Not sure if this is the correct thing to do, but
- it's required for compatibility with Outlook */
- return (SMIMESIGN|SMIMEOPAQUE);
+ {
+ if (!ascii_strcasecmp (SmimePkcs7DefaultSmimeType, "signed"))
+ return (SMIMESIGN|SMIMEOPAQUE);
+ else if (!ascii_strcasecmp (SmimePkcs7DefaultSmimeType, "enveloped"))
+ return SMIMEENCRYPT;
+ else
+ return 0;
+ }
else if (!ascii_strcasecmp ((t+len), "p7s"))
return (SMIMESIGN|SMIMEOPAQUE);
}
diff --git a/globals.h b/globals.h
index 3f22ad35..fd63bd43 100644
--- a/globals.h
+++ b/globals.h
@@ -313,6 +313,7 @@ WHERE char *SmimeSignOpaqueCommand;
WHERE char *SmimeEncryptCommand;
WHERE char *SmimeGetSignerCertCommand;
WHERE char *SmimePk7outCommand;
+WHERE char *SmimePkcs7DefaultSmimeType;
WHERE char *SmimeGetCertCommand;
WHERE char *SmimeImportCertCommand;
WHERE char *SmimeGetCertEmailCommand;
diff --git a/init.h b/init.h
index 9ca57281..dcb664f8 100644
--- a/init.h
+++ b/init.h
@@ -4016,6 +4016,20 @@ struct option_t MuttVars[] = {
** edited. This option points to the location of the private keys.
** (S/MIME only)
*/
+ { "smime_pkcs7_default_smime_type", DT_STR, R_NONE, {.p=&SmimePkcs7DefaultSmimeType}, {.p="signed"} },
+ /*
+ ** .pp
+ ** The application/pkcs7-mime ``.p7m'' type can contain EnvelopedData
+ ** (encrypted) or SignedData. Senders should add a ``smime-type''
+ ** parameter to the content type, to help receiving MUAs correctly
+ ** handle the data. Unfortunately, some clients (e.g. Outlook)
+ ** don't add this parameter.
+ ** .pp
+ ** This option is used to determine which type to assume when the
+ ** ``smime-type'' parameter is missing for ``.p7m'' file types.
+ ** .pp
+ ** Accepted values are ``enveloped'' and ``signed''.
+ */
{ "smime_pk7out_command", DT_STR, R_NONE, {.p=&SmimePk7outCommand}, {.p=0} },
/*
** .pp