diff options
author | drebs <drebs@leap.se> | 2014-11-25 11:55:49 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2014-11-25 11:55:49 -0200 |
commit | a3acaed8512c16fc1d53141d288d60eacc6ef94e (patch) | |
tree | cb01d4f96322213082b4469567831cc823464813 /src/leap | |
parent | 040faf2bf94db227246a00b38da8f92bfa0c8fa8 (diff) |
Move SMTP gateway str assertion to inside OutgoingMail.
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/mail/service.py | 3 | ||||
-rw-r--r-- | src/leap/mail/smtp/__init__.py | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/leap/mail/service.py b/src/leap/mail/service.py index d595067..f6e4d11 100644 --- a/src/leap/mail/service.py +++ b/src/leap/mail/service.py @@ -81,8 +81,9 @@ class OutgoingMail: :type port: int """ - # XXX: should we keep these checks? # assert params + leap_assert_type(from_address, str) + leap_assert('@' in from_address) leap_assert_type(keymanager, KeyManager) leap_assert_type(host, str) leap_assert(host != '') diff --git a/src/leap/mail/smtp/__init__.py b/src/leap/mail/smtp/__init__.py index f740f5e..72b26ed 100644 --- a/src/leap/mail/smtp/__init__.py +++ b/src/leap/mail/smtp/__init__.py @@ -22,7 +22,6 @@ import logging from twisted.internet import reactor from twisted.internet.error import CannotListenError -from twisted.mail import smtp from leap.mail.service import OutgoingMail logger = logging.getLogger(__name__) @@ -42,7 +41,7 @@ def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port, :param port: The port in which to run the server. :type port: int :param userid: The user currently logged in - :type userid: unicode + :type userid: str :param keymanager: A Key Manager from where to get recipients' public keys. :type keymanager: leap.common.keymanager.KeyManager @@ -61,7 +60,8 @@ def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port, :returns: tuple of SMTPFactory, twisted.internet.tcp.Port """ # configure the use of this service with twistd - outgoing_mail = OutgoingMail(str(userid), keymanager, smtp_cert, smtp_key, smtp_host, smtp_port) + outgoing_mail = OutgoingMail( + userid, keymanager, smtp_cert, smtp_key, smtp_host, smtp_port) factory = SMTPFactory(userid, keymanager, encrypted_only, outgoing_mail) try: tport = reactor.listenTCP(port, factory, interface="localhost") |