Patchwork mail: pass ui to sslutil.wrapsocket() even if verifycert is off (issue4713)

login
register
mail settings
Submitter Yuya Nishihara
Date June 7, 2015, 1:27 a.m.
Message ID <b414c113dd8d96a7084e.1433640458@mimosa>
Download mbox | patch
Permalink /patch/9549/
State Accepted
Headers show

Comments

Yuya Nishihara - June 7, 2015, 1:27 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1433637015 -32400
#      Sun Jun 07 09:30:15 2015 +0900
# Node ID b414c113dd8d96a7084edcb614a78d140aacb504
# Parent  6fabde6ef4453ee6c2aa964184f6cf2c54483621
mail: pass ui to sslutil.wrapsocket() even if verifycert is off (issue4713)

21b536f01eda made 'ui' argument is passed via sslutil.sslkwargs(), but mailer
doesn't call sslkwargs() if smtp.verifycert is off. So we have to put it in
sslkwargs manually.
Pierre-Yves David - June 7, 2015, 7:25 p.m.
On 06/06/2015 06:27 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1433637015 -32400
> #      Sun Jun 07 09:30:15 2015 +0900
> # Node ID b414c113dd8d96a7084edcb614a78d140aacb504
> # Parent  6fabde6ef4453ee6c2aa964184f6cf2c54483621
> mail: pass ui to sslutil.wrapsocket() even if verifycert is off (issue4713)

Pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -104,7 +104,8 @@  def _smtp(ui):
     if (starttls or smtps) and verifycert:
         sslkwargs = sslutil.sslkwargs(ui, mailhost)
     else:
-        sslkwargs = {}
+        # 'ui' is required by sslutil.wrapsocket() and set by sslkwargs()
+        sslkwargs = {'ui': ui}
     if smtps:
         ui.note(_('(using smtps)\n'))
         s = SMTPS(sslkwargs, local_hostname=local_hostname)