summaryrefslogtreecommitdiffstats
path: root/mutt_ssl.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2009-01-11 16:04:13 -0800
committerBrendan Cully <brendan@kublai.com>2009-01-11 16:04:13 -0800
commitc56f303ef9f0db2820740a742b34d7f8764127db (patch)
treef1e068b5cc8eb5af6752877a4fe692bd3c4aa3f4 /mutt_ssl.c
parentd0ddd64f63bca3f1ab60754a255eaf2110f183b3 (diff)
Add $ssl_verify_dates option to relax certificate date validation
Diffstat (limited to 'mutt_ssl.c')
-rw-r--r--mutt_ssl.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/mutt_ssl.c b/mutt_ssl.c
index 9242532e..7cf5371d 100644
--- a/mutt_ssl.c
+++ b/mutt_ssl.c
@@ -564,19 +564,22 @@ static int check_certificate_by_digest (X509 *peercert)
FILE *fp;
/* expiration check */
- if (X509_cmp_current_time (X509_get_notBefore (peercert)) >= 0)
+ if (option (OPTSSLVERIFYDATES) != M_NO)
{
- dprint (2, (debugfile, "Server certificate is not yet valid\n"));
- mutt_error (_("Server certificate is not yet valid"));
- mutt_sleep (2);
- return 0;
- }
- if (X509_cmp_current_time (X509_get_notAfter (peercert)) <= 0)
- {
- dprint (2, (debugfile, "Server certificate has expired"));
- mutt_error (_("Server certificate has expired"));
- mutt_sleep (2);
- return 0;
+ if (X509_cmp_current_time (X509_get_notBefore (peercert)) >= 0)
+ {
+ dprint (2, (debugfile, "Server certificate is not yet valid\n"));
+ mutt_error (_("Server certificate is not yet valid"));
+ mutt_sleep (2);
+ return 0;
+ }
+ if (X509_cmp_current_time (X509_get_notAfter (peercert)) <= 0)
+ {
+ dprint (2, (debugfile, "Server certificate has expired"));
+ mutt_error (_("Server certificate has expired"));
+ mutt_sleep (2);
+ return 0;
+ }
}
if ((fp = fopen (SslCertFile, "rt")) == NULL)
@@ -884,8 +887,10 @@ static int interactive_check_cert (X509 *cert, int idx, int len)
_("SSL Certificate check (certificate %d of %d in chain)"),
len - idx, len);
menu->title = title;
- if (SslCertFile && X509_cmp_current_time (X509_get_notAfter (cert)) >= 0
- && X509_cmp_current_time (X509_get_notBefore (cert)) < 0)
+ if (SslCertFile
+ && (option (OPTSSLVERIFYDATES) == M_NO
+ || (X509_cmp_current_time (X509_get_notAfter (cert)) >= 0
+ && X509_cmp_current_time (X509_get_notBefore (cert)) < 0)))
{
menu->prompt = _("(r)eject, accept (o)nce, (a)ccept always");
menu->keys = _("roa");