Skip to content

Commit

Permalink
Cannot TLS on server-side without certfile
Browse files Browse the repository at this point in the history
Fix broken test
  • Loading branch information
icgood committed Nov 4, 2016
1 parent 273885e commit 087e1af
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions slimta/edge/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@ class SmtpEdge(EdgeServer):
also be given as a list of SASL mechanism names to support,
e.g. ``['PLAIN', 'LOGIN', 'CRAM-MD5']``.
:param tls: Optional dictionary of TLS settings passed directly as
keyword arguments to :class:`gevent.ssl.SSLSocket`. ``False``
will explicitly disable TLS.
keyword arguments to :class:`gevent.ssl.SSLSocket`.
:param tls_immediately: If True, connections will be encrypted
immediately before the SMTP banner.
:param command_timeout: Seconds before the connection times out waiting
Expand Down
1 change: 0 additions & 1 deletion slimta/http/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def build_server(self, listener, pool=None, tls=None):
use for new greenlets.
:param tls: Optional dictionary of TLS settings passed directly as
keyword arguments to :class:`gevent.ssl.SSLSocket`.
``False`` will explicitly disable TLS.
:rtype: :class:`gevent.pywsgi.WSGIServer`
"""
Expand Down
9 changes: 4 additions & 5 deletions slimta/smtp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ class Server(object):
also be given as a list of SASL mechanism names to support,
e.g. ``['PLAIN', 'LOGIN', 'CRAM-MD5']``.
:param tls: Optional dictionary of TLS settings passed directly as
keyword arguments to :class:`gevent.ssl.SSLSocket`. ``False``
will explicitly disable TLS.
keyword arguments to :class:`gevent.ssl.SSLSocket`.
:param tls_immediately: If True, the socket will be encrypted
immediately.
:type tls_immediately: True or False
:param tls_wrapper: Optional function that takes a socket and the ``tls``
dictionary, creates a new encrypted socket, performs
the TLS handshake, and returns it. The default uses
:class:`~gevent.ssl.SSLSocket`.
:type tls_immediately: True or False
:param command_timeout: Optional timeout waiting for a command to be
sent from the client.
:param data_timeout: Optional timeout waiting for data to be sent from
Expand Down Expand Up @@ -117,7 +116,7 @@ def __init__(self, socket, handlers, auth=False,
self.extensions.add('PIPELINING')
self.extensions.add('ENHANCEDSTATUSCODES')
self.extensions.add('SMTPUTF8')
if self.tls is not False and not tls_immediately:
if self.tls and not tls_immediately:
self.extensions.add('STARTTLS')
if auth:
if isinstance(auth, list):
Expand Down Expand Up @@ -191,7 +190,7 @@ def handle(self):
:raises: :class:`~slimta.smtp.ConnectionLost` or unhandled exceptions.
"""
if self.tls is not False and self.tls_immediately:
if self.tls and self.tls_immediately:
if not self._encrypt_session():
tls_failure.send(self.io, flush=True)
return
Expand Down
2 changes: 1 addition & 1 deletion test/test_slimta_util_deque.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestBlockingDeque(unittest.TestCase, MoxTestBase):
def setUp(self):
super(TestBlockingDeque, self).setUp()
self.deque = BlockingDeque()
self.deque.sema = self.mox.CreateMock(Semaphore)
self.deque.sema = self.mox.CreateMockAnything()

def test_append(self):
self.deque.sema.release()
Expand Down

0 comments on commit 087e1af

Please sign in to comment.