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 | 694c3bf3e48e53d07aa0d383443f41e1689faae5 (patch) | |
tree | b6d92fd0655f8be51d5805dc883c31b6a36cd3f1 | |
parent | a6026b347db8cb56b56ba61a635b5a56e5107841 (diff) |
Move SMTP gateway str assertion to inside OutgoingMail.
-rw-r--r-- | mail/src/leap/mail/service.py | 3 | ||||
-rw-r--r-- | mail/src/leap/mail/smtp/__init__.py | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/mail/src/leap/mail/service.py b/mail/src/leap/mail/service.py index d595067..f6e4d11 100644 --- a/mail/src/leap/mail/service.py +++ b/mail/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/mail/src/leap/mail/smtp/__init__.py b/mail/src/leap/mail/smtp/__init__.py index f740f5e..72b26ed 100644 --- a/mail/src/leap/mail/smtp/__init__.py +++ b/mail/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") |