Correct auth without password or username.

If no username is set, returns an empty string. So the test `username is
not None` is always True. Idem for password. This can lead to
authentication problems. This commit fixes the test to `if username and
password` as it was in the previous version.
This commit is contained in:
Julien Enselme 2015-03-07 16:00:24 +01:00 committed by Martin Zimmermann
parent beca18a344
commit 7e58f6b97c

View File

@ -67,7 +67,7 @@ class SMTP(object):
username = self.conf.get('username') username = self.conf.get('username')
password = self.conf.get('password') password = self.conf.get('password')
if username is not None and password is not None: if username and password:
if PY2K: if PY2K:
username = username.encode('ascii') username = username.encode('ascii')
password = password.encode('ascii') password = password.encode('ascii')