[PATCH V2 STABLE 🚑] mail: actually use the verifycert config value

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Nov 6 03:32:49 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1415212299 0
#      Wed Nov 05 18:31:39 2014 +0000
# Branch stable
# Node ID aa6436f89b88f05584d500ec3d5e30180e3d4d88
# Parent  c35ffa4249cab47a1e089a30bc16fc65a0727f48
mail: actually use the verifycert config value

The mail module only verify the smtp ssl certificate if 'verifycert' is enabled
(the default). The 'verifycert' can take three possible values:

- 'strict'
- 'loose'
- any "False" value, eg: 'false' or '0'

We tested the validity of the third value, but never converted it to actual
falseness, making 'False' and equivalent for 'loose'.

This changeset fixes it.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -102,10 +102,11 @@ def _smtp(ui):
     verifycert = ui.config('smtp', 'verifycert', 'strict')
     if verifycert not in ['strict', 'loose']:
         if util.parsebool(verifycert) is not False:
             raise util.Abort(_('invalid smtp.verifycert configuration: %s')
                              % (verifycert))
+        verifycert = False
     if (starttls or smtps) and verifycert:
         sslkwargs = sslutil.sslkwargs(ui, mailhost)
     else:
         sslkwargs = {}
     if smtps:


More information about the Mercurial-devel mailing list