For backwards compatibility, only set smime_ca_location if
~/.smime/ca-certificates.crt or ~/.smime/ca-bundle.crt exists.
Otherwise, use the OpenSSL compiled defaults.

The change to $smime_ca_location in contrib/smime.rc is based on the
Debian patch authored by Antonio Radici.  Thanks to Todd Zullinger for
pointing the patch out to me.

Make the %C parameter conditional in $smime_verify_command and
$smime_verify_opaque_command, so an unset value uses the OpenSSL
compiled defaults.

Update the smime-notes.txt to describe the new behavior of
$smime_ca_location, and advise the user to set it if their
distribution openssl is not compiled with a default set of trusted
roots.
---

Note: I've elided the ca-bundle.crt lines again.

 contrib/Makefile.am   |    2 +-
 contrib/ca-bundle.crt | 4599 -----------------------------------------
 contrib/smime.rc      |    9 +-
 doc/smime-notes.txt   |    9 +-
 4 files changed, 11 insertions(+), 4608 deletions(-)
 delete mode 100644 contrib/ca-bundle.crt

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index cf8656b4..5fffae7d 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -6,7 +6,7 @@ SAMPLES = Mush.rc Pine.rc gpg.rc pgp2.rc pgp5.rc pgp6.rc Tin.rc 
\
        sample.mailcap sample.muttrc sample.muttrc-sidebar sample.muttrc-tlr \
        sample.muttrc-compress sample.muttrc-starter \
        sample.vimrc-sidebar colors.default colors.linux smime.rc \
-       ca-bundle.crt smime_keys_test.pl mutt_xtitle markdown2html \
+       smime_keys_test.pl mutt_xtitle markdown2html \
        bgedit-detectgui.sh bgedit-screen-tmux.sh \
        mutt_oauth2.py mutt_oauth2.py.README
 
diff --git a/contrib/ca-bundle.crt b/contrib/ca-bundle.crt
deleted file mode 100644
index 12b997d6..00000000
--- a/contrib/ca-bundle.crt
+++ /dev/null

diff --git a/contrib/smime.rc b/contrib/smime.rc
index ea2df0ce..c278f146 100644
--- a/contrib/smime.rc
+++ b/contrib/smime.rc
@@ -47,7 +47,10 @@
 # unset smime_decrypt_use_default_key
 
 # Path to a file or directory with trusted certificates
-set smime_ca_location="~/.smime/ca-bundle.crt"
+set smime_ca_location=\
+  "`for f in \
+  $HOME/.smime/ca-certificates.crt $HOME/.smime/ca-bundle.crt \
+  ; do if [ -e $f ] ; then echo $f ; exit ; fi ; done`"
 
 # Path to where all known certificates go. (must exist!)
 set smime_certificates="~/.smime/certificates"
@@ -97,11 +100,11 @@ set smime_sign_command="openssl smime -sign -md %d -signer 
%c -inkey %k -passin
 set smime_decrypt_command="openssl cms -decrypt -passin stdin -inform DER -in 
%f -inkey %k -recip %c"
 
 # Verify a signature of type multipart/signed
-set smime_verify_command="openssl smime -verify -inform DER -in %s %C -content 
%f"
+set smime_verify_command="openssl smime -verify -inform DER -in %s %?C?%C? 
-content %f"
 
 # Verify a signature of type application/pkcs7-mime
 set smime_verify_opaque_command="\
-openssl smime -verify -inform DER -in %s %C || \
+openssl smime -verify -inform DER -in %s %?C?%C? || \
 openssl smime -verify -inform DER -in %s -noverify 2>/dev/null"
 
 # application/pkcs7-mime ".p7m" messages should have a smime-type
diff --git a/doc/smime-notes.txt b/doc/smime-notes.txt
index 25ead497..8ad02293 100644
--- a/doc/smime-notes.txt
+++ b/doc/smime-notes.txt
@@ -40,11 +40,10 @@ How to add use mutt's S/MIME capabilities
 - Edit the smime_sign_as line in your muttrc, replacing the keyid with your
   own.
 
-- You probably want to import the trusted roots in
-  contrib/ca-bundle.crt. This makes you trust anything that was ultimately
-  signed by one of them. You can use "smime_keys add_root" to do so, or
-  just copy ca-bundle.crt into the place you point mutt's smime_ca_location
-  variable to.
+- Most distributions compile OpenSSL with a default set of trusted roots.
+  If yours does not, you probably want to set $smime_ca_location.
+  For backward compatibility, the contrib/smime.rc sets this to an existing
+  ~/.smime/ca-certificates.crt or ~/.smime/ca-bundle.crt.
 
 
 
-- 
2.56.1

Reply via email to